zoukankan      html  css  js  c++  java
  • sql语句like多个条件的写法实例

    这篇文章介绍了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
  • 相关阅读:
    安装依赖包
    python之高阶函数编程
    ubuntu之安装java浏览器插件
    python之函数式编程
    openstack第1天
    mysql null 相关bug
    nginx 【转】
    python mock
    查看docker 内各个容器的ip
    python sqlparse 各种 token
  • 原文地址:https://www.cnblogs.com/firstdream/p/6097919.html
Copyright © 2011-2022 走看看