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 ;

6 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. I think we need only the sum of the orders not the name maybe.

    ReplyDelete
  2. It is said Grouped By Customer and State.
    Not Order.Name
    Am I getting wrong somewhere?

    ReplyDelete
    Replies
    1. Yes you are wrong. There is no field name with "Customer", then can we do so.
      We have to group it by Customer name.

      Delete
  3. how is GROUP BY ORDERS.NAME , STATE possible when there is no field of STATE in table ORDERS ?

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post