SQL query joining rows with same value
- by user1285737
I need to write a query that creates a view that calculates the total cost of each sale, by considering quantity and price of each bought item. The view should return the debit and total cost.
In the answer each debit-number should only occur once.
Thanks in advance
Table ITEM:
ID NAME PRICE
118 Jeans 100
120 Towel 20
127 Shirt 55
Table DEBIT:
DEBIT ITEM Quantity
100581 118 5
100581 120 1
100586 127 5