mysql中的where子句不返回空


mysql where clause in not return empty?

你好,这是我的桌子。

表名是位置

id      location
1       location1
2       location2
3       location3
4       location2
5       location4
6       location3

以下是查询。

SELECT * FROM location WHERE `location` IN ('location2,location1')

它返回空值i需要输出到表中的所有位置1和位置2记录

我需要的输出是

1    location1
2    location2
4    location2

谢谢。

SELECT * FROM location WHERE `location` IN ('location2' ,'location1') LIMIT 20

您的错误出现在包含可能值的引号中。