Nth Largest element from a table sql Query

Posted by Binu on Stack Overflow See other posts from Stack Overflow or by Binu
Published on 2010-05-30T06:28:08Z Indexed on 2010/05/30 6:32 UTC
Read the original article Hit count: 206

Filed under:

can any one explain hiow this query works..It's for getting the Nth largest elemet from a table.here it's 4 th largest

SELECT a.ID
  FROM tblitem a
 WHERE (4) = (select count(*)
                from tblItem  b
               where b.id < a.id)

Thanks in advance

© Stack Overflow or respective owner

Related posts about sql-server