雖然我的查詢執行這一新概念Common Table Expressions
:SQL選擇:使用CTE爲數據集IN子句 - 語法錯誤
SELECT ..... FROM .... WHERE ... IN
(
;with CTEName as
(
CTE syntax goes here
)
SELECT .... FROM CTEName
)
GROUP BY ....
仍然得到下面的查詢錯誤:
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near ';'.
Msg 102, Level 15, State 1, Line 14
Incorrect syntax near ')'.
是這樣的CTE的有效使用?
謝謝。
這不是你如何引用一個CTE ..... – 2011-04-21 10:32:59
在這裏你會找到答案http://www.simple-talk.com/sql/t-sql-programming/sql-server-cte-basics/ – 2011-04-21 10:35:28
';'是SQL中的語句終結符 - 你將不會在語句中找到它。只是覺得我應該指出,因爲它可能會幫助你在未來圍繞類似的問題推理。 – 2011-04-21 10:37:50