MySQL附近的正确语法

时间:2013-04-16 11:15:35

标签: mysql

select c.*
from costs c
where 32 between c.x and c.x + c.deltax and 34 between c.y + c.deltay
order by priority desc
limit 1

继续说#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 'order by priority desc limit 1' at line 4。我错过了什么?

1 个答案:

答案 0 :(得分:2)

您的第二个between只有一个要检查的条件,它缺少and

34 between c.y + c.deltay

你想用吗?

34 between c.y and c.y + c.deltay