This is really dirty query 😏
You're making 2 table scans to compute length and count where it could be done in 1
You are viewing a single comment's thread from:
This is really dirty query 😏
You're making 2 table scans to compute length and count where it could be done in 1
Sorry :)
Is this better?
!ENGAGE 100
:(
Sent you some directly :)
If's way better! You can even use the new IIF() function to make it more readable:
select sum(IIF(depth = 0, 1,0) AS Postcount, sum(IIF(depth > 0, 1, 0)AS Commentcount, sum(IIF(depth > 0, len(body), 0) AS CommentLength, sum(IIF(depth > 0, 1, 0))/sum(IF(depth = 0, 1, 0)) AS CommentsPerpost, sum(IIF(depth > 0, len(body), 0))/sum(IIF(depth > 0, 1,0) AS Commlen_avg from comments where author = 'arcange' ```<div class="pull-right"><sub><a href="/steemreply/@arcange/introducing-steemreply-stay-in-touch-with-your-steem-network">Posted with <img src="http://steemreply.com/logo-comment.png"/></a></sub></div>