Home > DeveloperSection > Forums > Select column value which coloumn value is max
Ankit Singh

Total Post:341

Points:2389
Posted on    March-11-2013 4:13 AM

 MSSQL Server MSSQL Server 
Ratings:


 2 Reply(s)
 966  View(s)
Rate this:

Hi Everyone!

I have a table (tblEmployee) as per bellow

ID        Name           Salary
--          -----              ------
1           Mark           15000
2           Samuel        20000
3           Ethon           26000
4           Gotibandhu 15000

I want to select name which Employee salary is max

Please help me!



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    March-11-2013 8:42 AM

Hi Ankit!

You can get name using nested query or sub query, as following

select [name] from [tblEmployee] where [salary] = (select max(salary) from [tblEmployee])

Shankar M

Total Post:25

Points:175
Posted on    April-09-2013 9:04 PM

Hi Ankit,

You can give a try to this one,

SELECT TOP 1 * FROM tblEmployee ORDER BY SALARY DESC

Thanks,
Shankar

Don't want to miss updates? Please click the below button!

Follow MindStick