HomeMore on SQL List the sum of the totals of orders grouped by customer and state. 6 Comments Facebook Twitter Q. List the sum of the totals of orders grouped by customer and state. Consider this table -- You can understand by seeing this video --- Answer :-SELECT ORDERS.NAME , SUM( QUANTITY ) FROM ORDERS , CUSTOMERS WHERE ORDERS.PARTNUM = PARTS.PARTNUM GROUP BY ORDERS.NAME , STATE ;
I think we need only the sum of the orders not the name maybe.
ReplyDeleteI have also summed only QUANTITY.
DeleteIt is said Grouped By Customer and State.
ReplyDeleteNot Order.Name
Am I getting wrong somewhere?
Yes you are wrong. There is no field name with "Customer", then can we do so.
DeleteWe have to group it by Customer name.
how is GROUP BY ORDERS.NAME , STATE possible when there is no field of STATE in table ORDERS ?
ReplyDeleteState is present in customer table.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )