select * from table
where FIND_IN_SET(id,'1,2,3')
等同于
select * from table
where id in (1,2,3)
思考:如果以逗号分隔的数据来自另一个表的某个字段,以下sql有什么区别(ids ='1,2,3')
(1)select * from table a,table2 b
where a.id in (b.ids)
(2)select * from table a,table2 b
where FIND_IN_SET(a.id,b.ids)
Sql FIND_IN_SET()函数select * from tablewhere FIND_IN_SET(id,'1,2,3')等同于select * from tablewhere id in (1,2,3)思考:如果以逗号分隔的数据来自另一个表的某个字段,以下sql有什么区别(ids = '1,2,3')(1)select * from table a,table2 b ...