How to List particular Records in sql server

Posted by Jayakumars under Sql Server on 11/28/2019 | Points: 10 | Views : 4300 | Status : [Member] [MVP] | Replies : 1
hi


--CREATE TABLE EMPNAME1
--(
--EMPID INT PRIMARY KEY IDENTITY(1,1),
--EMPNAME NVARCHAR(100),
--EMPSALARY DECIMAL(18,2)
--)

--Insert into EMPNAME1 VALUES('AA1',1000)
--Insert into EMPNAME1 VALUES('AA2',2000)
--Insert into EMPNAME1 VALUES('AA1',500)
--Insert into EMPNAME1 VALUES('AA2',800)


-- i NEED Highest Values only show
-- both employee highest value only need

-- I need this output
-- EMPID empname empsalary
-- 1 AA1 10000
-- 4 AA2 800

Mark as Answer if its helpful to you

Kumaraspcode2009@gmail.com



Responses

Posted by: Sheonarayan on: 11/28/2019 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Following query will give you highest salary value of each employee.

SELECT EmpName, max(EMPSALARY) FROM EMPNAME1 group by EmpName


Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response