我有这个 MySQL 查询。
我有包含这些内容的数据库字段
sports,shopping,pool,pc,games shopping,pool,pc,games sports,pub,swimming, pool, pc, games
为什么这样的查询不起作用?我需要运动场或酒吧场或两者兼而有之?
SELECT * FROM table WHERE interests LIKE ('%sports%', '%pub%')
该(a,b,c)列表仅适用于in. 对于like,您必须使用or:
(a,b,c)
in
like
or
WHERE interests LIKE '%sports%' OR interests LIKE '%pub%'