View Single Post
  #21 (permalink)  
Old 02-21-2008, 07:21 AM
Unregistered
 
Posts: n/a
Default ANY answer. Re: How to find second highest value of a column in a table?

[sql]select b.field1
from (select distinct field1 from tab1) a,
(select distinct field1 from tab1) b
where a.field1>=b.field1
group by b.field1
having count(b.field)=3[/sql]


by changing the value (3) in last line you will get nth max value
Reply With Quote