select distinct 供应商,商品 from (select table.*,count(*) over(partition by 供应商) num from table) where num > 1
bzszp(SongZip)的方法不对。按你的写法每个供应商只能选出一条记录。 select distinct * from t where exists(select 1 from t t1 where t1.供应商=t.供应商 and t1.rowid<>t.rowid);
汗,一种比较笨的写法,还是可行的: select * FROM tb a where a.rowid = (select min(b.rowid) from tb b where a.供应商 = b.供应商 and a.商品 = b.商品) intersect select * FROM tb where 供应商 in (select 供应商 from ( select 供应商, count(1) FROM tb group by 供应商 having count(1) >1))
select distinct * from t where exists(select 1 from t t1 where t1.供应商=t.供应商 and t1.rowid<>t.rowid);
select * FROM tb a where a.rowid = (select min(b.rowid)
from tb b where a.供应商 = b.供应商 and a.商品 = b.商品)
intersect
select * FROM tb
where 供应商 in
(select 供应商 from (
select 供应商, count(1) FROM tb group by 供应商 having count(1) >1))