0

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?

Trevor Wood
  • 2,347
  • 5
  • 31
  • 56

2 Answers2

2

yes - try something along of the lines of:

SELECT SUM(integer) FROM tbl WHERE user_id = 'xxx'
Tom
  • 9,725
  • 3
  • 31
  • 48
2

You could do something like

SELECT sum(integer) As ReturnValue
FROM table
WHERE user_id = [value]
Michael Armes
  • 1,056
  • 2
  • 17
  • 31