SQL query, 3 tables -


Well, I'm in trouble and hopefully willing to there to help ... I know that the question Not working, mostly because I am not an expert for this stuff, but you should give an idea what my goal is here is my own interpretation:

  Select ID, USER_LOGIN, select user_email (sum (no_votes wp_users) post_author Where wp_posts = wp_users.ID) + (sum (comment_karma) f the wp_comments Not where user_id = wp_users.ID)   

Production of basic information than the sum of all users list "wp_users" table and votes from two other tables numbers ( "wp_posts" and "wp_comments") Should collect, where wp_users.ID matches.

Thanks in advance!

subquery: SELECT

  ID, USER_LOGIN, user_email, (sum (select no_votes) post_author where wp_posts = wp_users.ID) + (sum (comment_karma) select wp_comments where user_id = wp_users .id)   

or fROM clause with subqueriesin:

  id, USER_LOGIN, user_email, wp_posts_group.sum_no_votes + wp_comments_group.sum_comment_karma as Vot_awr_kama FR OM wp_users left external add Given (SELECT post_author, sum (no_votes) as sum_no_votes P_posts by group_posts_group wp_posts_group at wp_posts_group wp_posts_group.post_author = wp_users.id on the left outer join (wp_comments GROUP BY user_id as SELECT user_id, SUM (comment_karma) sum_comment_karma) wp_comments_group.user_id = wp_users.id  at wp_comments_group < / Pre>  

Comments