我有一个 mysql 查询不断返回错误
错误:
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 ' iOS= 0, Android= 0, sport IN (football,tennis,' at line 2
整个查询是
INSERT INTO table2
SELECT *
FROM table1
WHERE iOS = 0
, android = 0
, sport IN (football,tennis,golf)
(iOS 和 android 列是 bool 值,sport 是 VARCHAR
)
查询旨在获取 iOS/android 列为 0 且运动列值为足球、网球或高尔夫的所有条目。
错在哪里?感谢您的帮助
最佳答案
使用 AND
或 OR
包含更多条件。
文字字符串使用引号分隔:
INSERT INTO table2
SELECT * FROM table1
WHERE iOS = 0
AND android = 0
AND sport IN ('football', 'tennis', 'golf')
关于mysql - "Insert into where"语句错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27059101/