2015-05-04 76 views
1

我試圖使用帶有「加入」操作員查詢和「使用」的條款,以避免使用「自然加入」但不知何故,我得到一切的時候出現以下錯誤:使用條款導致數據庫兼容模式錯誤

"sID" is not a recognized table hints option. If it is intended as a parameter to a table-valued function or to the CHANGETABLE function, ensure that your database compatibility mode is set to 90.

查詢我用的是:

select sName, GPA 
from Student join Apply using (sID) 
where sizeHS < 1000 and major = 'CS' and cName = 'Stanford'; 

這兩個Tabels包含列是 「SID」。

兼容性在90/100/110上發生了變化,但沒有一個修正了我的問題。爲了確保我正確地改變了我用兼容模式:

SELECT compatibility_level 
FROM sys.databases 
WHERE name = 'databasePath' 

回答

2

您可以在oracle使用using (sID)不是爲sql server。對於sql server你必須使用加入這樣

select sName, GPA 
from Student 
join Apply on Apply.sID = Student.sID 
where sizeHS < 1000 and major = 'CS' and cName = 'Stanford'; 
+0

'Apply.sID = Student.sID'不'Apply.sID和Student.sID' –

+0

@Aツ更正,謝謝! – Parado

+0

有趣的...教師在SQL課程視頻我只是從中學習使用,沒有提到它不是ms-sql兼容...我知道這是關閉的話題,但有一個網站/網站,我可以檢查是否某些運算符與我正在使用的數據庫兼容? – Gizzy