我有一个MySQL查询.
我有包含此内容的数据库字段
sports,shopping,pool,pc,games
shopping,pool,pc,games
sports,pub,swimming, pool, pc, games
为什么这样的查询不起作用?
SELECT * FROM table WHERE interests LIKE ('%sports%', '%pub%')
我有一个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
:
WHERE interests LIKE '%sports%' OR interests LIKE '%pub%'