add7 Starting Member
2 Posts
sodeep Flowing Fount of Yak Knowledge
USA 7173 Posts
quote:Originally posted by sodeepPlease show us what you have tried. What Salary do you consider as maximum?
visakh16 Very Important crosS Applying yaK Herder
India 47069 Posts
quote:Originally posted by add7quote:Originally posted by sodeepPlease show us what you have tried. What Salary do you consider as maximum?I tried by using MAX and joining the two tables. but that gives only one name and not all the names having the salary=max salary.
SELECT TOP 1 WITH TIES * FROM Table ORDER BY Salary DESC
SELECT * FROM ( SELECT DENSE_RANK() OVER (ORDER BY Salary DESC) AS Rnk,* FROM Table )t WHERE Rnk=1