Hello friends
Pls refere to my previous thread where we have discussed on sorting oprtion of Adding order by whereever group by is applicable
3624069
Read?
Then come to my point
if there is multiple columns for the group by then if we want to include order by clause, same number of columns has to be included in the order by also.
i dont think it is so
example'
SELECT SUM(QTY1),SUM(QTY2), PARTNO, PART_DESC
from part_sen
group by partno, part_desc
order by partno, part_desc
qty1 qty2 partno partdesc
70 101 I001 BRAKE SHOE
56 54 I002 HORN
30 30 I003 GEAR
15 5 I004 DOOR
5 5 I007 MOTOR GEAR
10 15 I008 ANCILLARY
10 15 I009 Window
so in order by clause we can include only the first column.. that is partno
SELECT SUM(QTY1),SUM(QTY2), PARTNO, PART_DESC
from part_sen
group by partno, part_desc
order by partno
Same result i get.
Pls give your suggestion
s