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)
exists(select COL2 from DATA_SJ where COL2=b.COL2 group by COL2 having count(COL2)<2)
exists(select COL2 from DATA_SJ where COL2=b.COL2 group by COL2 having count(COL2)<2)
不好意思,我的表名叫t
where a.col1=b.col1 and a.col2<>b.col2
不知道这样能不能得到楼主想要的结果