vb sql 怎么模糊查询到ou但不包括our的数据。希望查询到的是包含ou,但不希望出现our(里面也包含ou)

解决方案 »

  1.   

    先查询到包含ou的,再剔除包含our的
      

  2.   

    select * from table_name where xxx like '%ou'
      

  3.   

    select * from 表名 where 字段名 like 'ou[^r]%'
      

  4.   

    这个查询下来只有OUselect * from lcc where name  not like 'our' and name like '%ou%'这样可以
      

  5.   


    create table lcc
    (
    id int identity(1,1) primary key,
    name varchar(20) not null 
    )
    insert into lcc values('our')
    insert into lcc values('ou')
    insert into lcc values('cou')
    insert into lcc values('cour')
    insert into lcc values('ourm')
    insert into lcc values('xxx')
    select * from lcc
    select * from lcc where name  not like 'our' and name like '%ou%'
      

  6.   

    http://download.csdn.net/source/1644211