How to select second largest value from a table

It is easier to select second largest field from a table .

Syntax:    Select * from table_name where column_name = (select MAX(column_Name) from table_name where column_name=(select MAX(column_name) from table_name))

Example:  If we are going to select the second largest field from a table "table_2" according to the value in the field Subscriber_HCID . Means we are going to select the entire row from a table having the Subscriber_HCID should be the second largest

select * from t1 where id=(select MAX(id) from t1 where id<(select MAX(id)from t1))

Comments

Popular posts from this blog

Introduction To Oracle10g

Insert

Except