[b]Question asked by visitor Steve[/b]
What will be the query to get the name of 3rd most expense item from table Item (ID,Name,Price)?
Printable View
[b]Question asked by visitor Steve[/b]
What will be the query to get the name of 3rd most expense item from table Item (ID,Name,Price)?
The same thing is already discussed for 788th greatest in the following link:
[url]http://www.geekinterview.com/talk/2460-details-emp-having-788th-highest-salary.html[/url]
I think this will help you.
To get the 3rd most expensive item :
Select b.price , b.Id , b.name
from Item b, Item b
where
b.price <= a.price
group by (b.price)
having count(b.price) = 3