How to we calculate the nth maximum value of a column?
Db2
Collapse
X
-
sajithamolTags: None -
Suppose you have a table called items with a column called price then to find the item with the third highest price you can tryOriginally posted by sajithamolHow to we calculate the nth maximum value of a column?
[CODE=sql]SELECT * FROM items a WHERE 3 = (SELECT COUNT(DISTINCT( b.PRICE)) FROM items b WHERE a.price <= b.price)[/CODE]
Comment