sql - Trying to Group Rows -
i thought distinct statement group orders.customer_num, doesn't seem case. believe has expression in select statement. new sql.
select distinct orders.customer_num "customer number", count(orders.order_num) "number of orders", sum(items.quantity) "total quantity", stock.unit_price "unit price", items.quantity * stock.unit_price "total price" orders, items, stock orders.order_num = items.order_num , items.stock_num = stock.stock_num group orders.customer_num, items.quantity, stock.unit_price order orders.customer_num;
attached pic showing getting. my result
your stock.unit_price
seems unique. logically selects unit_price
per item
. either need discard stock
table , related join conditions or sum up
Comments
Post a Comment