pkedpker Posted April 24, 2012 Share Posted April 24, 2012 How would I go about getting whoreferred added up their reward and show it under name sspoke. Say I login sspoke I should see jayman there with a reward of 33+21=0.54 I also want to see all the other users other then jayman and their totals SUM'ed up. I have no clue how to go about making this query mysql> SELECT * FROM referrers; +----+----------+-------------+--------+---------------------+ | id | referrer | whoreferred | reward | date_credited | +----+----------+-------------+--------+---------------------+ | 1 | Admin | sspoke | 0.43 | 2012-04-24 14:04:06 | | 2 | Admin | sspoke | 0.43 | 2012-04-24 14:04:06 | | 3 | sspoke | jayman | 0.33 | 2012-04-24 14:04:06 | | 4 | sspoke | jayman | 0.21 | 2012-04-24 14:04:06 | +----+----------+-------------+--------+---------------------+ Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 24, 2012 Share Posted April 24, 2012 Try SELECT referrer, whoreferred, SUM(reward) FROM referrers GROUP BY referrer, whoreferred Quote Link to comment Share on other sites More sharing options...
pkedpker Posted April 24, 2012 Author Share Posted April 24, 2012 perfect thanks jesirose SELECT referrer, whoreferred, SUM(reward) FROM referrers WHERE referrer='sspoke' GROUP BY referrer, whoreferred Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 24, 2012 Share Posted April 24, 2012 BTW you might want to rename two of those columns to be more clear. Plus the one has a bad word in it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.