select COL1,COL2 from DATA_SJ b where exists(select COL1 from t where COL1=b.COL1 group by COL1 having count(COL1)>1) and 
exists(select COL2 from DATA_SJ where COL2=b.COL2 group by COL2 having count(COL2)<2)

解决方案 »

  1.   

    select COL1,COL2 from DATA_SJ b where exists(select COL1 from DATA_SJ where COL1=b.COL1 group by COL1 having count(COL1)>1) and 
    exists(select COL2 from DATA_SJ where COL2=b.COL2 group by COL2 having count(COL2)<2)
    不好意思,我的表名叫t
      

  2.   

    select a.col1,a.col2 from data_sj a,data_sj b 
    where a.col1=b.col1 and a.col2<>b.col2
    不知道这样能不能得到楼主想要的结果