Advertisement
matriphe

SQL Query Getting Contributor's Report

Dec 9th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.37 KB | None | 0 0
  1. SELECT
  2. (SELECT
  3.     COUNT(`c`.`ID`)
  4.     FROM `wp_posts` `c`
  5.     WHERE `c`.`post_author` = `a`.`ID`
  6.     AND `c`.`post_type` = 'post'
  7.     AND `c`.`post_status` = 'publish'
  8. ) AS `count`,
  9. `a`.*
  10. FROM `wp_users` `a`
  11. LEFT JOIN `wp_usermeta` `b` ON `a`.`ID` = `b`.`user_id`
  12. WHERE `b`.`meta_key` = 'wp_user_level'
  13. AND `b`.`meta_value` = 1 -- contributor
  14. ORDER BY `a`.`user_login`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement