我通过大学连接到远程数据库,并且具有以下代码,用于看似简单的查询。无法弄清楚为什么我收到此错误:
Msg 207, Level 16, State 1, Line 3
Invalid column name 'USA'.
如果这是我们之前下载的相同数据库并执行了本地查询,那么该列应该可以顺利运行。我通过Sequel Management Studio的代码是:
SELECT Customers.CompanyName, Customers.ContactName, Customers.Country
FROM Customers
WHERE (Customers.Country="Mexico") OR (Customers.Country="USA") OR (Customers.Country="Canada")
答案 0 :(得分:1)
您在查询中使用了错误的引号,请使用'
代替"
:
SELECT Customers.CompanyName, Customers.ContactName, Customers.Country
FROM Customers
WHERE (Customers.Country='Mexico')
OR (Customers.Country='USA')
OR (Customers.Country='Canada')