Click here to Skip to main content
15,910,277 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have 10 records in my table ............
now I want to find the second minimum value from the Fess column............
how to get it
Posted

Simple one
SQL
SELECT TOP 1 Fees FROM
(
    select top 2 * from table order by Fees ASC
) AS Table ORDER BY Fees DESC
 
Share this answer
 
Comments
Ravinder Soran 25-Oct-13 0:39am    
High level commands,,,,,,,,,but thanks bro
Amol_B 25-Oct-13 0:50am    
Cheers! Just want to demonstrate a way without using aggregate function
SQL
select top 1 ColumnName from TableName where ColumnName not in (select top 1 ColumnName from TableName order by ColumnName asc)

Example:
SQL
select top 1 id from std where id not in (select top 1 id from std order by id asc )
 
Share this answer
 
SELECT MIN(CustID) AS [2ndMin]
FROM Customer
WHERE (CustID >(SELECT MIN(CustID) FROM Customer))
 
Share this answer
 
Select MIN(Sal) From TableName
Where Sal > (Select MIN(sal) From TableName)
 
Share this answer
 
Comments
Ravinder Soran 25-Oct-13 0:40am    
This is t#he best and simplest answer ....thanks
SQL
select min(your_field) from your_table where your_field NOT IN (select distinct TOP 1 your_field from your_table ORDER BY your_field DESC)

Regards...
 
Share this answer
 
v2
Comments
Rakshith Kumar 16-Oct-13 2:29am    
perfect :)
Ravinder Soran 25-Oct-13 0:38am    
Thanks Bro...
Thanks7872 25-Oct-13 0:39am    
You are welcome. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900