June 29, 2004 at 11:51 pm
Hi All,These are the records I've in my table. I need to return top 3 countries (rank) by Sales.Record Date Country Sales1 01.01.04 AU 80%2 01.01.04 IN 92%3 01.01.04 CH 50%4 01.01.04 USA 75%5 01.01.04 SG 25% The result set should be:Record Date Country Sales2 01.01.04 IN 92%1 01.01.04 AU 80%4 01.01.04 USA 75%How to write query for that?ThanxRgdsK.Senthil Kumar
June 29, 2004 at 11:58 pm
Hi All,
This is my questions. Pl. ignore the previous one.
These are the records I've in my table.
I need to return top 3 countries (rank) by Sales.
Record Date Country Sales
1 01.01.04 AU 80%
2 01.01.04 IN 92%
3 01.01.04 CH 50%
4 01.01.04 USA 75%
5 01.01.04 SG 25%
The result set should be:
Record Date Country Sales
2 01.01.04 IN 92%
1 01.01.04 AU 80%
4 01.01.04 USA 75%
How to write query for that?
Thanx
Rgds
K.Senthil Kumar
June 30, 2004 at 12:01 am
Try something like this:
select top 3 record, date, country, sales
from (tablename)
order by sales desc
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply