Skip to content

Instantly share code, notes, and snippets.

@ringmaster
Created May 20, 2010 01:57
Show Gist options
  • Save ringmaster/407106 to your computer and use it in GitHub Desktop.
Save ringmaster/407106 to your computer and use it in GitHub Desktop.
SELECT habari__postinfo.value, count(habari__posts.id) from habari__posts
INNER join habari__posttype on habari__posts.content_type = habari__posttype.id and habari__posttype.name = 'page'
inner join habari__postinfo on habari__posts.id = habari__postinfo.`post_id` and `habari__postinfo`.name = 'year'
INNER JOIN habari__poststatus on habari__posts.status = habari__poststatus.id and habari__poststatus.name = 'published'
group by habari__postinfo.value
ORDER BY habari__postinfo.value DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment