Skip to content

Instantly share code, notes, and snippets.

@michaeltwofish
Created May 26, 2010 01:32
Show Gist options
  • Save michaeltwofish/413932 to your computer and use it in GitHub Desktop.
Save michaeltwofish/413932 to your computer and use it in GitHub Desktop.
$years = DB::get_column(
"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 = ?
INNER JOIN habari__postinfo ON habari__posts.id = habari__postinfo.`post_id` AND `habari__postinfo`.name = ?
INNER JOIN habari__poststatus ON habari__posts.status = habari__poststatus.id AND habari__poststatus.name = ?
GROUP BY habari__postinfo.value
ORDER BY habari__postinfo.value DESC",
array('imprint', 'year', 'published')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment