You are viewing a single comment's thread from:

RE: ENGAGE > Big Macs / LIFESTYLE Trade / Win some Tokens

in #engagement5 years ago

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>