select * from t a where exists(select * from t where a1=a.a2 and a2=a.a1)

解决方案 »

  1.   

    select * from t a where exists(select * from t where a1=a.a2 and a2=a.a1 and id<>a.id)
      

  2.   

    select * from tbl where exists(select * from  tbl a inner join tbl b on a.a1=b.a2 and a.a2=b.a1)
      

  3.   

    select * from t a where exists(select * from t where a1=a.a2 and a2=a.a1 and id<>a.id)
      

  4.   

    select   a.* from aaa a inner join  aaa b on a.a2=b.a1 and  a.a1=b.a2
      

  5.   

    select a.id,a.a1,a.a2 from tb1 a,(select * from tb1)b where a.a1=b.a2 and a.a2=b.a1
      

  6.   

    select   a.* from aaa a inner join  aaa b on a.a2=b.a1 and  a.a1=b.a2