firstdream
这篇文章介绍了sql语句like多个条件的写法实例,有需要的朋友可以参考一下
 
表A 
no name
1   lu,li,zhang 
2   zhou,wei,liu 
3   li,fang 
表B 
no name  sex
1   li          1
2   lu         0
3   zhou    0
4   zhang  1 

怎么实现
复制代码 代码如下:

select * from A where A.name like (select B.name from B where B.sex=1)

----------------------------------------------------------------------------------------------------------------------------
sqlserver写法
复制代码 代码如下:

select distinct a.no,a.name from a,b where charindex(b.name,a.name)>0 and b.sex=1
 
oracle写法
复制代码 代码如下:

select distinct a.no,a.name from a,b where instr(a.name,b.name)>0 and b.sex=1

----- instr() 定位子串 instr(\'Hello World\', \'or\')   返回8

分类:

技术点:

相关文章:

  • 2021-12-22
  • 2021-08-14
  • 2021-11-19
  • 2021-08-07
  • 2021-06-03
  • 2021-12-06
  • 2021-11-18
  • 2021-12-23
猜你喜欢
  • 2021-11-22
  • 2021-08-07
  • 2021-07-07
  • 2021-12-10
  • 2021-09-25
  • 2021-08-07
  • 2021-11-16
相关资源
相似解决方案