1.如果你要查A2中有1,2,3的字段A1   结果为:a,e
select a1 from aa where a2=1
INTERSECT
select a1 from aa where a2=2
INTERSECT
select a1 from aa where a2=3
2.  ..
3.  ..

解决方案 »

  1.   

    select a1 from tname where a2 in (1,2,3)
      

  2.   

    如果我要查A2中有1,2,3的字段A1   结果为:a,e
    Select DISTINCT A1 from AA where A2 in (1,2,3)如果我要查A2中有1,3的字段A1   结果为:a,d,e
    Select DISTINCT A1 from AA where A2 in (1,3)如果我要查A2中有1,2的字段A1   结果为:a,c,e
    Select DISTINCT A1 from AA where A2 in (1,2)
      

  3.   

    onejune4450(中文字符)的是对的,或者你可以这样select a1 from aa where a2=1 and a2 = 2 and a2 = 3
      

  4.   

    onejune4450(中文字符)的应该是正确的
      

  5.   

    谢谢 onejune4450(中文字符)  回答。
    你的结果是正确的,但是还有没有更好的方法呢?
    因为字段A2的内容是变化的,这样的话SQL语句也变化很大,比较麻烦。
      

  6.   

    Select A1 from AA where A2 in (1,2,3) group by a1 having count(1)=3Select A1 from AA where A2 in (1,3) group by a1 having count(1)=2Select A1 from AA where A2 in (1,2) group by a1 having count(1)=2