Reputation: 4166
How to make two sum process on same column? I tried:
SELECT SUM(score)
FROM user
WHERE id = 33
or id = 44
group by id
I need to get score of (user 33) and (user 44) separately.
Thanks in advance.
Upvotes: 0
Views: 58
Reputation: 300549
Group by id, and then filter using HAVING
clause:
SELECT id, SUM(score)
FROM user
group by id
having id = 33 or id = 44
[As @Jens pointed out, your original query works just fine: SQLFiddle ]
Upvotes: 3