sql语句like多个条件的写法实例

前端之家收集整理的这篇文章主要介绍了sql语句like多个条件的写法实例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<DIV class="line number2 index1 alt1"><CODE class="sql plain">表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 怎么实现
<div class="codetitle"><a style="CURSOR: pointer" data="79456" class="copybut" id="copybut79456" onclick="doCopy('code79456')"> 代码如下:

<div class="codebody" id="code79456">
select * from A where A.name like (select B.name from B where B.sex=1)

----------------------------------------------------------------------------------------------------------------------------
sqlserver写法
<div class="codetitle"><a style="CURSOR: pointer" data="71170" class="copybut" id="copybut71170" onclick="doCopy('code71170')"> 代码如下:
<div class="codebody" id="code71170">
select distinct a.no,a.name from a,b where charindex(b.name,a.name)>0 and b.sex=1

oracle写法
<div class="codetitle"><a style="CURSOR: pointer" data="49144" class="copybut" id="copybut49144" onclick="doCopy('code49144')"> 代码如下:
<div class="codebody" id="code49144">
select distinct a.no,b where instr(a.name,b.name)>0 and b.sex=1 ----- instr() 定位子串 instr('Hello World','or') 返回8

likesqlsql多个条件

猜你在找的MsSQL相关文章