1

Suppose I have table like:

name: table_money

enter image description here

I need a sql query that produces the following result containing sum of money for each id.

a

How can I find out the total money of an individual id?

What is the SQL query?

quasoft
  • 5,291
  • 1
  • 33
  • 37
Ishmam Shahriar
  • 51
  • 3
  • 10

1 Answers1

2

To get the sum for each ID you need to group the results by the id column and apply the SUM aggregate function to the money column.

SELECT id, SUM(money) 
FROM table_money
GROUP BY id

You can read more about grouping of SQL results here:

Community
  • 1
  • 1
quasoft
  • 5,291
  • 1
  • 33
  • 37