Trevor Wood Trevor Wood - 1 month ago 9
SQL Question

Is it possible to select * where then add all results?

I have a sql table with a

user_id
and an
integer


Is it possible to select
integer
from table where
user_id
= ?
then add all integer results together and return just the one integer result?

Answer

You could do something like

SELECT sum(integer) As ReturnValue
FROM table
WHERE user_id = [value]