SQL Syntax Issues
I can't for the life of me figure out what's wrong with this sql statement
select top(1)
OrderNumber
from (select top(5)
OrderNumb开发者_运维百科er
from SomeTable
where TreePath='tests'
order by OrderNumber asc)
Any Ideas?
Regards, Byron Cobb.
You need to alias the derived table
select top 1
myDerivedTable.OrderNumber
from (select top 5
OrderNumber
from TABLE
where TreePath='tests'
order by OrderNumber asc) myDerivedTable
order by myDerivedTable.OrderNumber
精彩评论