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 (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
  • 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

  • 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

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply