select * from tabel1 where store_name in ('V北京农村合作社','V上海农村除污社','V上海农村环保社','V上海农村烧烤真的不好吃社','L厦门农村打假社')
要达(假设‘%’有通配符作用)到这种效果:
    (‘%北京%’,‘%上海%’,‘%厦门%’)

解决方案 »

  1.   

    select * from tabel1 
    where store_name like '%北%'
          or store_name like '%上海%'
        .....
      

  2.   


    select * from tabel1 where store_name like '%北京%' or store_name like ...
    --看来和#1一样
      

  3.   


    select * from tabel1 where store_name in ('V北京农村合作社','V上海农村除污社','V上海农村环保社','V上海农村烧烤真的不好吃社','L厦门农村打假社')select * from tabel1 a1 where exists(
    select top 1 * from 合作社表 a2
    where a1.store_name like '%'+substring(a2.name,2,2)+'%'
    )
    --substring(a2.name,2,2)取某某社的第二第三个字,如'V北京农村合作社',就取‘北京’
      

  4.   


    select * from tabel1 a1 where exists(
    select top 1 * from 合作社表 a2
    where a1.store_name like '%'+substring(a2.name,2,2)+'%'
    )