註釋DELETE語句並嘗試使用SELECT語句時,代碼運行正常。 請幫助使用連接時DELETE查詢中的錯誤
DELETE FROM
--select * from
Site as s
join
(select SiteID,Code, Name, Dense_rank() over (partition by Code order by SiteID) as Rank from Site
) as t
on s.SiteID = t.SiteID
WHERE t.Rank != 1
獲得以下錯誤消息
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'as'.
Msg 156, Level 15, State 1, Line 8
Incorrect syntax near the keyword 'as'.
這DBMS是什麼? –
Sql服務器,但我認爲這個問題是通用的SQL查詢 –
不,它不是通用的,因爲並非所有的DBMS都支持刪除語句中的JOIN,並且一些語法有完全不同的語法 –