Skip to content

Instantly share code, notes, and snippets.

@deegoods
Created June 9, 2014 22:40
Show Gist options
  • Save deegoods/1d260ae1b14bfe0d5457 to your computer and use it in GitHub Desktop.
Save deegoods/1d260ae1b14bfe0d5457 to your computer and use it in GitHub Desktop.
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment