4个字段
 
auit 字段 bool的判断 值1,0
Suppliers 字段 厂家
 Suppliers1 字段 厂家1 
Suppliers2  字段 厂家2 
   
selet 出 auit=0 并且厂家(Suppliers,Suppliers1,Suppliers2)都有相同值的sql 谢谢啊

解决方案 »

  1.   

    select *
    from ta 
    where auit = 0 and suppliers = suppliers1 and suppliers = suppliers2
      

  2.   

    --?
    select * from tb where auit=0 and Suppliers=Suppliers1 and Suppliers1=Suppliers2
      

  3.   


    select 
      * 
    from 
      tb 
    where 
      auit = 0 and suppliers = suppliers1 and suppliers = suppliers2
      

  4.   

    包含?
    SELECT * FROM @a
    WHERE audit=0 AND
    CASE WHEN CHARINDEX(S,S1)>0 AND CHARINDEX(S,S2)>0 THEN 1 ELSE 0 END+
    CASE WHEN CHARINDEX(S1,S)>0 AND CHARINDEX(S1,S2)>0 THEN 1 ELSE 0 END+
    CASE WHEN CHARINDEX(S2,S1)>0 AND CHARINDEX(S2,S)>0 THEN 1 ELSE 0 END
    >0
      

  5.   

    那个没结果的,就是说 这个sql要满足auit = 0 并且 要满足 suppliers  suppliers1  suppliers2
     只要出现就查询的到 貌似楼上的想复杂了 
      

  6.   


    select * from tb 
    where 
        auit=0 and 
        (suppliers is not null or suppliers1 is not null or suppliers2 is not null ) 
    只要出现就查询的到---还是这个意思啊?