List Info

Thread: order by then sort




order by then sort
country flaguser name
United States
2008-02-18 07:37:48

hi guys
i have requirement where i have to group the records by item id, find the sum of the quantity of a particular item id group, after adding a sum i want to sort them based on the highest qty

Ex: if i have items
item qty
1000 50
1000 20
1000 10
2000 60
2000 30
300 20
300 10

my desired result would 2000(highest qty 90),1000(80),300...like wise i have to perform

what i have done is written a job like this

select sum(qty) from inventtrans group by itemid;

i m nt getting how to sort them later.... pls help


---------------------------------
Now you can chat without downloading messenger. Click here to know how.

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )