比如一张表:
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的即为存在,返回记录)

相关文章:

  • 2022-12-23
  • 2021-09-29
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2022-01-16
猜你喜欢
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
相关资源
相似解决方案