Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT u.*, um.meta_value, um2.last_activity, pt.postnum, ptt.threadnum
- FROM wp_wp_users u
- Left Join
- (Select user_id, meta_value From wp_wp_usermeta
- Where meta_key = "wp_wp_capabilities") um
- On um.user_id = u.ID
- Left Join
- (Select user_id, meta_value as last_activity From wp_wp_usermeta
- Where meta_key = "last_activity") um2
- On um2.user_id = u.ID
- Left Join
- (Select post_author, count(*) as postnum From wp_wp_posts
- Where post_type = "reply" or post_type = "page" or post_type = "post"
- Group by post_author) pt
- On pt.post_author = u.ID
- Left Join
- (Select post_author, count(*) as threadnum From wp_wp_posts
- Where post_type = "topic" or post_type = "forum"
- Group by post_author) ptt
- On ptt.post_author = u.ID
Advertisement
Add Comment
Please, Sign In to add comment