I have a table PRODUCT
with following attributes:
PRODUCTCODE(PK)
PRODDESCRIPTION
PRICE
STOCKLEVEL
Another table is PRODLINE
with following attributes:
ORDERNUMBER(FK)
PRODCODE(FK)
QUANTITY
Now For each product I want to list out the Product_code
, stock_level
and the total quantity ordered. How can this be performed?
SELECT A.PRODUCTCODE, A.STOCKLEVEL, SUM(A.QUANTITY)
FROM PRODUCT A
INNER JOIN PRODLINE B ON A.PRODUCTCODE=B.PRODCODE
GROUP BY A.PRODUCTCODE
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.