select
Orders.OrderID,
Orders.OrderDate,
Customers.CustomerID,
Customers.City,
Customers.Country
from
Orders,
Customers
where
(Customers.City like '[abc]%') and
order by Customers.Country desc;
它显示以下错误:
查询表达式中的语法错误(缺少运算符)'(Customers.City 比如'[abc]%')和'
我对sql不太专业。
所以请帮助我。
答案 0 :(得分:3)
您应该在and
order by
select Orders.OrderID, Orders.OrderDate, Customers.CustomerID, Customers.City,Customers.Country
from Orders, Customers
where (Customers.City like '[abc]%')
/*and you should add a condition something like
Orders.CustomerID= Customers.CustomerID*/
order by Customers.Country desc;
答案 1 :(得分:3)
从您的查询中移除......
答案 2 :(得分:3)
简单,删除AND
SELECT ORDERS.ORDERID,
ORDERS.ORDERDATE,
CUSTOMERS.CUSTOMERID,
CUSTOMERS.CITY,
CUSTOMERS.COUNTRY
FROM ORDERS,
CUSTOMERS
WHERE ( CUSTOMERS.CITY LIKE '[abc]%' )
ORDER BY CUSTOMERS.COUNTRY DESC;
祝你好运!
答案 3 :(得分:0)
试试这个
select Orders.OrderID, Orders.OrderDate, Customers.CustomerID,
Customers.City,Customers.Country
from Orders, Customers
where Customers.City like '[abc]%'
order by Customers.Country desc;
and
和where
order by
答案 4 :(得分:0)
使用以下
select Orders.OrderID, Orders.OrderDate, Customers.CustomerID, Customers.City,Customers.Country
from Orders, Customers
where (Customers.City like '[abc]%')
order by Customers.Country desc;
我在and
之前仅删除了order by
。它会起作用。
答案 5 :(得分:0)
您不需要和:
where (Customers.City like '[abc]%')