Kamiikaze

Untitled

Aug 20th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. SELECT u.*, um.meta_value, um2.last_activity, pt.postnum, ptt.threadnum
  2. FROM wp_wp_users u
  3.  
  4. Left Join
  5. (Select user_id, meta_value From wp_wp_usermeta
  6. Where meta_key = "wp_wp_capabilities") um
  7. On um.user_id = u.ID
  8.  
  9. Left Join
  10. (Select user_id, meta_value as last_activity From wp_wp_usermeta
  11. Where meta_key = "last_activity") um2
  12. On um2.user_id = u.ID
  13.  
  14. Left Join
  15. (Select post_author, count(*) as postnum From wp_wp_posts
  16. Where post_type = "reply" or post_type = "page" or post_type = "post"
  17. Group by post_author) pt
  18. On pt.post_author = u.ID
  19.  
  20. Left Join
  21. (Select post_author, count(*) as threadnum From wp_wp_posts
  22. Where post_type = "topic" or post_type = "forum"
  23. Group by post_author) ptt
  24. On ptt.post_author = u.ID
Advertisement
Add Comment
Please, Sign In to add comment