Skip to content

Instantly share code, notes, and snippets.

@deegoods
deegoods / gist:1d260ae1b14bfe0d5457
Created June 9, 2014 22:40
total posts with at least one comment
3. total posts with at least one comment:
select count(distinct(posts.id)) from posts left outer join comments on posts.id = comments.post_id where comments.id is not null and posts.deleted is null and comments.deleted is null;