这是我的查询:
select * from
(select name,empID,salary,[deducted salary] = salary-7000 from tblEmpDetails
order by Joined_Date) TmpTbl where [decucted salary] > 50000
它给出了错误:
The ORDER BY clause is invalid in views, inline functions, derived tables,
subqueries, and common table expressions, unless TOP or FOR XML is also specified.
然后我将查询更改为:
select * from
(select TOP 100 PERCENT name,empID,salary,[deducted salary] = salary-7000
from tblEmpDetails order by Joined_Date) TmpTbl where [decucted salary] > 50000
现在它工作正常。
我的查询是使用 TOP 100 是正确的方法还是有任何其他解决方法?