Let's say I have a table name receipts. Then the table has a receipt_num, product, and price.
Let's say I have a table that looks like this.
receipt_num | item | price
--------+------+------
6 | a | 10
6 | b | 15
1 | c | 7
What SQL query can I use to get something like this.
receipt_num | price
--------+------+------
6 | 25
1 | 7
Essentially I am combining all the rows with the same receipt_num, excluding the item column and adding up the total price.
I have tried using SELECT receipt_num, price FROM receipts. I am very new at this so I am not sure what I am doing wrong.