计数不同时出现错误 1064
Error 1064 when COUNTING DISTINCT
我的查询语句
SELECT Count(DISTINCT name)
FROM facebook.users
结果
mysql.ProgrammingError: (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 '\xef\xbb\xbfSELECT Count(DISTINCT name)
\r\nFROM facebook.users' at line 1")
我该如何解决这个问题,谢谢
您应该检查您是如何传递查询的。 \xef\xbb\xbf
是 UTF-8 BOM.
The UTF-8 representation of the BOM is the (hexadecimal) byte sequence 0xEF,0xBB,0xBF
SELECT Count(DISTINCT name) FROM facebook.users
-- query is correct
我的查询语句
SELECT Count(DISTINCT name)
FROM facebook.users
结果
mysql.ProgrammingError: (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 '\xef\xbb\xbfSELECT Count(DISTINCT name) \r\nFROM facebook.users' at line 1")
我该如何解决这个问题,谢谢
您应该检查您是如何传递查询的。 \xef\xbb\xbf
是 UTF-8 BOM.
The UTF-8 representation of the BOM is the (hexadecimal) byte sequence 0xEF,0xBB,0xBF
SELECT Count(DISTINCT name) FROM facebook.users
-- query is correct