One Liner...

...tujhe bhi apne pe ye aeitbaar hai ki nahi...

Saturday, April 30, 2011

Query to fetch 2nd highest record.

This query will let you fetch then second highest record from the set of record.

Table struture

Name Type
----------------------------------------- --
ID NUMBER
NAME VARCHAR2(30)
MARKS NUMBER

Query:

select * from student
where marks =
(select max(marks)
from student
where
marks<(select max(marks) from student));

No comments:

Post a Comment