当前位置:Gxlcms > 数据库问题 > mysql find_in_set在oracle下的解决方案

mysql find_in_set在oracle下的解决方案

时间:2021-07-01 10:21:17 帮助过:48人阅读

比如一张表:
artile (id,type,content);
type:1表示文艺类,2表示小说类,3表示传记,4表示传说,等等5,6,7,8

表数据:
id type content
1 3,1 dfasdfasdf
2 1,3,6,8 dfasdf
3 6,8,9 add
现在要找出3传记类的artile记录

mysql: select * from artile where find_in_set(‘3‘,type);

oralce 语句实现:
select * from artile da where instr(‘,‘||type||‘,‘,‘,3,‘)<>0;
(原理:将1,3,6,8转为 ,1,3,6,8,然后找出 ,3,的位置
将3,1转为 ,3,1,然后找出 ,3,的位置
则<>0的即为存在,返回记录)

mysql find_in_set在oracle下的解决方案

标签:sele   fas   mysql   小说   表数   dfa   asd   ||   表数据   

人气教程排行