1.MySQL
1.1.正确写法
select * from student where find_in_set(`s_id`, '1,2,3');
1.2.错误示范
select * from student where find_in_set(`s_id`, '1,2 ,3');
select * from student where find_in_set(`s_id`, '1,2, 3');
select * from student where find_in_set(`s_id`, '1,2 , 3');
2.Oracle
2.1.方式一
select *
from student
where s_id in
(
select regexp_substr('1,2,3', '[^,]+', 1, level) as value
from dual
connect by regexp_substr('1,2,3', '[^,]+', 1, level) is not null
);
2.2.方式二
SELECT *
FROM student
WHERE ',' || '1,2,3' || ',' LIKE '%,' || s_id || ',%';