补充:例如 A=a, B=b, E=e 或 A=a, C=c , D=d

解决方案 »

  1.   

    自己都写啦,继续把组合都写出来不就成了:(A=a and B=b and E=e) or (A=a and C=c and D=d) or (...) ...
      

  2.   

    建議加個keyID 字段 
    declare @keyID varcahr(10) 
    declare @icount int
    set @icount = 0
    if exists( select 1 from where A = 'a' and KeyId = @keyID)
    set @icount = @icount + 1
    if exists( select 1 from where B = 'b' and KeyId = @keyID)
    set @icount = @icount + 1
    if exists( select 1 from where C = 'c' and KeyId = @keyID)
    set @icount = @icount + 1
    if exists( select 1 from where D = 'd' and KeyId = @keyID)
    set @icount = @icount + 1
    if exists( select 1 from where E = 'e' and KeyId = @keyID)
    set @icount = @icount + 1
    if @icount = 3
    select * from tb1 where KeyID = @keyID