Skip to content

Instantly share code, notes, and snippets.

@stammy
Created April 29, 2009 18:09
Show Gist options
  • Save stammy/103935 to your computer and use it in GitHub Desktop.
Save stammy/103935 to your computer and use it in GitHub Desktop.
SELECT count(DISTINCT blogs.*) AS count_distinct_blogs_all FROM `blogs` LEFT OUTER JOIN taggings blogs_taggings ON blogs_taggings.taggable_id = blogs.id AND blogs_taggings.taggable_type = 'Blog' LEFT OUTER JOIN tags blogs_tags ON blogs_tags.id = blogs_taggings.tag_id WHERE (context = 'tags' AND blogs_tags.name LIKE 'Technology') ORDER BY created_at DESC LIMIT 0, 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment