Query for Top 6 and 5 Max

Discussion in 'Databases' started by lobelitp, Jun 5, 2009.

  1. #1
    Hi,

    I need to fetch the 6th top and 5th max record in my database.

    assume everything is integer datatype....

    Thanks in Advance
     
    lobelitp, Jun 5, 2009 IP
  2. CreativeClans

    CreativeClans Peon

    Messages:
    128
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What? Could you elaborate a bit more? An example perhaps?
     
    CreativeClans, Jun 12, 2009 IP
  3. babanesma

    babanesma Well-Known Member

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    116
    #3
    I think it could be like that , try it and tell .
    
    select *
    from (
    select *
    from table_name
    order by column_name desc
    limit 6 
    )
    order by column_name asc
    limit 2 
    Code (markup):
     
    babanesma, Jun 12, 2009 IP