我有一个sql查询
Select * from `products`
where (`product_company`='mad over donuts' OR
`product_company`= 'dunkin donuts')
AND (`flavour`='vanilla')
AND (355 < `price` < 561 ) ;
它获取大于某个固定价格和小于某个固定价格的元素。它还包括其他约束。但是,当我运行此 sql 查询时,它给了我一个
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"Select * from
products
where (product_company
='mad over donuts' OR `product' at line 1.
我检查了我的 sql 语法,我似乎没有发现问题。有人吗?
最佳答案
代替这个
Select * from `products`
where (`product_company`='mad over donuts' OR
`product_company`= 'dunkin donuts')
AND (`flavour`='vanilla')
AND (355 < `price` < 561 )";
"导致问题
试试这个
Select * from `products`
where (`product_company`='mad over donuts' OR
`product_company`= 'dunkin donuts')
AND (`flavour`='vanilla')
AND (`price`BETWEEN 355 and 561 );
关于mysql - SQL错误1064,语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35946537/