我不能为我的生活弄清楚这个sql语句有什么问题
select top(1)
OrderNumber
from (select top(5)
OrderNumber
from SomeTable
where TreePath='tests'
order by OrderNumber asc)
任何想法?
此致 Byron Cobb。
答案 0 :(得分:7)
您需要为派生表添加别名
select top 1
myDerivedTable.OrderNumber
from (select top 5
OrderNumber
from TABLE
where TreePath='tests'
order by OrderNumber asc) myDerivedTable
order by myDerivedTable.OrderNumber