22,300
社区成员




SELECT b.*
FROM (
SELECT TYPE
FROM tb
GROUP BY type
HAVING COUNT(DISTINCT CUSTOMER) >= 2
) a
JOIN tb b
ON a.TYPE = b.TYPE
ORDER BY ID
ID TYPE CUSTOMER
----------- ---- --------
1 A a
2 A b
select * from tb
where type in (
select type from (select distinct TYPE, CUSTOMER from tb) a group by type having count(*)>=2
)
select id,tb.type,customer from tb,
(select TYPE,COUNT(TYPE ) shl from tb group by TYPE having COUNT(TYPE ) >=2)a
where tb.TYPE =a.TYPE