Skip to content

Instantly share code, notes, and snippets.

@pwaldhauer
Created January 14, 2015 22:20
Show Gist options
  • Save pwaldhauer/c878884ab397f7b9d613 to your computer and use it in GitHub Desktop.
Save pwaldhauer/c878884ab397f7b9d613 to your computer and use it in GitHub Desktop.
Most liked blogposts
SELECT p.guid, CAST(pm.meta_value AS UNSIGNED) as abc FROM `wp_postmeta` AS `pm`
left join wp_posts AS p ON pm.post_id = p.id
where
p.post_date between '2014-01-01' and '2015-01-01'
and
pm.meta_key = 'like_count'
order by abc DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment