首页 > 数据库技术 > 详细

mysql find_in_set在oracle下的解决方案

时间:2019-06-10 18:11:55      阅读:238      评论:0      收藏:0      [点我收藏+]

比如一张表:
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下的解决方案

原文:https://www.cnblogs.com/wuxu/p/10999257.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!