MySQL SELECT的字段小于和大于值

时间:2013-04-07 17:01:42

标签: mysql phpmyadmin

我正在尝试使用phpMyAdmin或带有PDO的PHP对MySQL进行选择查询。

SELECT 'uid' FROM 'clusters' WHERE 'lat'<='47.21125' AND 'lat'>='39.21125' AND 'lng'<='32.90243' AND 'lng'>='22.90243'

然而,phpMyAdmin说:

#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 ''clusters' WHERE 'lat'<='47.21125' AND 'lat'>='39.21125' AND 'lng'<='32.90243' A' at line 1

它出了什么问题?

1 个答案:

答案 0 :(得分:8)

''在MySQL中创建一个字符串文字,因此您的查询是从文字“群集”中选择文字“uid”,这是无效的。使用背景(或没有)

SELECT Uid FROM clusters WHERE lat <= 47.21125 AND lat >= 39.21125
AND lng >= 22.90243