您的位置:首页 > 数据库

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

2016-11-24 15:13 197 查看
这篇文章介绍了sql语句like多个条件的写法实例,有需要的朋友可以参考一下

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: