我有这个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%'