Mysql &引用;在其中插入“;语句错误

Mysql &引用;在其中插入“;语句错误,mysql,Mysql,我有一个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 SELE

我有一个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列是布尔值,sport是一个
VARCHAR

查询的目的是获取iOS/android列为0、sports列值为football或tennis或golf的所有条目


哪里错了?感谢您提供的任何帮助

您的
语句有误。您必须在子句之间添加
条件

WHERE iOS = 0 AND android = 0 AND sport IN ('football', 'tennis', 'golf')

您的
WHERE
语句是错误的。您必须在子句之间添加
条件

WHERE iOS = 0 AND android = 0 AND sport IN ('football', 'tennis', 'golf')

只需键入而不是(逗号),并在单引号中写下运动名称

INSERT INTO table2 SELECT * FROM table1 WHERE `iOS` = 0 and android = 0 and (sport IN ('football','tennis','golf'))

只需键入而不是(逗号),并在单引号中写下运动名称

INSERT INTO table2 SELECT * FROM table1 WHERE `iOS` = 0 and android = 0 and (sport IN ('football','tennis','golf'))

使用
包含更多条件

文字字符串使用引号分隔:

INSERT INTO table2
SELECT * FROM table1
WHERE iOS = 0
AND android = 0
AND sport IN ('football', 'tennis', 'golf')

使用
包含更多条件

文字字符串使用引号分隔:

INSERT INTO table2
SELECT * FROM table1
WHERE iOS = 0
AND android = 0
AND sport IN ('football', 'tennis', 'golf')

使用
而不是逗号来构建您的条件使用
而不是逗号来构建您的条件当我将其更改为“和”时,我得到错误:where子句中的未知列“football”一个问题解决了,还有更多。。引用字符串。在括号内的值中添加引号。当我将其更改为“and”时,我得到错误错误:“where子句”中的未知列“football”解决了一个问题,还有更多。。引用字符串。在括号内的值上添加引号。