i am rather a newbie...but i was wonder what select statement i can use to retreieve the 10 top values from a table...for instance the 10 books that sell the most....
Select title, author, price, noofsales where noofsales between ????
if use between i need 2 values the MAX(noofsales) that would give me one value for the between..how do i find the 10 value?
or is there another select one could use?
Comments
:
: Select title, author, price, noofsales where noofsales between ????
:
: if use between i need 2 values the MAX(noofsales) that would give me one value for the between..how do i find the 10 value?
:
: or is there another select one could use?
It depends some on which database you are using. With newer versions of Informix, I think you can do "select first 10 title, author...". With Oracle, you can do:
[code]
Select *
from (select title, author, price, noofsales
from table
order by noofsales desc)
where rownum < 11
[/code]
/Chris