We know that, how to select a maximum Record from table Using SQL SERVER.
For Example.
select max(stor_id) from sales
Syntax:
select max(Column_name) from Table_name
But, It is little bit complex to find a Second Max Record From Table.
We can Overcome this Problem by using this Simple Query.
select max(stor_id) from sales where stor_id not in (select max(stor_id) from sales)
Syntax:
select max(Column_name) from Table_name where Column_name not in (select max(Column_name) from Table_name)
This is Nested Sub Query.
Monday, December 29, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment