-1
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 like '[abc]%') 和' 中的语法错误(缺少运算符)

我在sql方面不是那么专家。

所以请帮助我。

4

6 回答 6

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;
于 2013-08-06T07:23:44.457 回答
3

从您的查询中删除和......

于 2013-08-06T07:23:58.033 回答
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; 

祝你好运!

于 2013-08-06T07:24:02.193 回答
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

于 2013-08-06T07:25:37.000 回答
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. 它会起作用的。

于 2013-08-06T07:26:02.340 回答
0

你不需要和:

where (Customers.City like '[abc]%')
于 2013-08-06T07:26:16.000 回答