Reputation: 39
I have table named (TB1) with columns (Device - Order_id - qty) ....
I want write sql query to show each (order No) with (device name) with (total device qty) in this order ... I know we must use (group by) ... But I don't know how do that
Upvotes: 0
Views: 61
Reputation: 4806
You can group by two columns like this : group by col1, col2
.
So your query should be something like:
select Device, Order_no, sum(Qty)
from table_name
group by Device, Order_no
Upvotes: 1