SalId
TOP
select em.* from employees em join ( select max(SalId) as SalId,EmpId from employees group by EmpId) as s on em.SalId = s.SalId and em.EmpId = s.EmpId
select * from [tbl_emps] where [alId] in( SELECT max(alId) FROM [tbl_emps] group by empid )
SELECT * FROM (SELECT EmpId,SalId, DENSE_RANK() OVER (PARTITION BY SalId ORDER BY EmpId DESC) AS RNK FROM @EMP ) AS A WHERE A.RNK=1
select * from Table_Name where SalID in ( select Max(SalID) as SalID from Table_Name where EmpID in (68,69,82,83,94) group by EmpID)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)