我需要爲我的聯合查詢實現分頁,但出現錯誤「Msg 102,Level 15,State 1,Line 14 ''''附近的語法不正確。我跟着我從這個link發現的例子。SQL Server 2008 R2分頁
select *
from (select Id,
row_number() OVER (order by Id asc) as RowNumber
from (select Id
from (select Id
from Table1) as table1
union all
select Id
from (select Id
from Table2) as table2)) as t Derived
WHERE RowNumber > 5
and RowNumber <= 10
發生了什麼事?你有錯誤嗎? – Axarydax 2011-02-02 06:49:11
已更新的答案包含錯誤消息。 – newbie 2011-02-02 06:51:21
我從來不喜歡SQL Server的錯誤位置,但我在代碼中計算了12行。你有沒有粘貼過什麼? – donkim 2011-02-02 06:55:00