SQL query joining rows with same value
Posted
by
user1285737
on Stack Overflow
See other posts from Stack Overflow
or by user1285737
Published on 2012-03-22T11:33:09Z
Indexed on
2012/03/22
23:29 UTC
Read the original article
Hit count: 171
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
© Stack Overflow or respective owner