Hi All,
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
SELECT TOP 3 Record, Date, Country, Sales
FROM your_table
ORDER BY Sales DESC
Jacco Schalkwijk
SQL Server MVP
"K.Senthil Kumar" <K.Senthil Kumar@.discussions.microsoft.com> wrote in
message news:6EB6A9BF-7A6D-4B10-8F9D-CC9087946489@.microsoft.com...
> Hi All,
> 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
Showing posts with label rank. Show all posts
Showing posts with label rank. Show all posts
Monday, March 19, 2012
How to find Rank(return Top 3 Country)
Hi All,
These are the records I've in my table. I need to return top 3 countries (r
ank) 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 KumarSELECT TOP 3 Record, Date, Country, Sales
FROM your_table
ORDER BY Sales DESC
Jacco Schalkwijk
SQL Server MVP
"K.Senthil Kumar" <K.Senthil Kumar@.discussions.microsoft.com> wrote in
message news:6EB6A9BF-7A6D-4B10-8F9D-CC9087946489@.microsoft.com...
> Hi All,
> 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
These are the records I've in my table. I need to return top 3 countries (r
ank) 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 KumarSELECT TOP 3 Record, Date, Country, Sales
FROM your_table
ORDER BY Sales DESC
Jacco Schalkwijk
SQL Server MVP
"K.Senthil Kumar" <K.Senthil Kumar@.discussions.microsoft.com> wrote in
message news:6EB6A9BF-7A6D-4B10-8F9D-CC9087946489@.microsoft.com...
> Hi All,
> 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
Subscribe to:
Posts (Atom)