Would like to get the SUM of two specific rows in a table in mysql.
create table people(
id int,
firstname varchar(50),
money int
);
id firstname money
1 david 100
2 jack 200
3 bob 300
Say I want the SUM of row 1(david) and row 3(bob) only. The total should be 400.
I used this query:
SELECT SUM(money)
FROM people
WHERE id = 1 AND 3;
but it turned out to be 100, and not 400 as I expected.