SELECT MIN(Salary) FROM (
SELECT TOP 10 Salary FROM tblEmp ORDER BY Salary DESC) AS X
As such the resultset of the above query will only have the record of
the Salary column. I want the record of another column named EmpName as
well in the resultset. So where do I accomodate the 'GROUP BY EmpName'
clause in the above query to get the EmpName in the resultset?
Thanks,
ArpanOne way to accomplish this:
SELECT
Salary,
EmpName
FROM tblEmp
WHERE Salary =
(
SELECT
MIN(Salary)
FROM
(
SELECT TOP 10
Salary
FROM tblEmp
ORDER BY
Salary DESC
) AS X
)
Adam Machanic
SQL Server MVP
http://www.datamanipulation.net
--
"Arpan" <arpan_de@.hotmail.com> wrote in message
news:1130343229.752921.153920@.o13g2000cwo.googlegroups.com...
> SELECT MIN(Salary) FROM (
> SELECT TOP 10 Salary FROM tblEmp ORDER BY Salary DESC) AS X
> As such the resultset of the above query will only have the record of
> the Salary column. I want the record of another column named EmpName as
> well in the resultset. So where do I accomodate the 'GROUP BY EmpName'
> clause in the above query to get the EmpName in the resultset?
> Thanks,
> Arpan
>|||Thanks, Adam.
Regards,
Arpan
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment