You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Need to select top 100 vendors based on sum of VOUCHER.GROSS_AMT in query manager

3 replies [Last post]
Guest's picture
Guest

I need to sum the VOUCHER.GROSS_AMT by vendor in query manager and only return the top 100. Can this be done?

Lepa's picture
User offline. Last seen 5 days 11 hours ago. Offline
Joined: 06/23/2008
Posts: 570
Re: Need to select top 100 vendors based on sum of ...

sure this can be done - you need 3 things:
1. Write your query with your sum(VOUCHER.GROSS_AMT)
2. Order by sum(VOUCHER.GROSS_AMT) desc (to get resutls from top down)
3. Add the below expression to your "where" clause:

and rownum <= 100

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

Nitin's picture
User offline. Last seen 39 weeks 4 days ago. Offline
Joined: 06/30/2008
Posts: 58
Re: Need to select top 100 vendors based on sum of ...

I think rownum <=100 will work only on Oracle ..
How about other platform?

Cheers
Nitin

Venkataramani's picture
User offline. Last seen 27 weeks 4 days ago. Offline
Joined: 08/29/2008
Posts: 10
Re: Need to select top 100 vendors based on sum of ...

for db2 we can use fetch 100 rows only for the same...

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
The question below is to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.