1. select * from( select data.*,count(1)over(partition by ref_id)c from data) where c=12. select count(distinct ref_id) from data
1. 如果重复的记录要取一条,而不是全都不显示 可以 select * from( select data.*,row_number()over(partition by ref_id order by rownum)rn from data) where rn=1
1: select id,ref_id,num from tab where refid in(select refid from tab a having count(*)=1 group by a.refid ) 2: select count(distinct ref_id) from tab a
真是简单的题啊!1. select * from( select data.*,count(1)over(partition by ref_id)c from data) where c=1 2. select count(distinct ref_id) from data
select * from(
select data.*,count(1)over(partition by ref_id)c
from data)
where c=12.
select count(distinct ref_id) from data
如果重复的记录要取一条,而不是全都不显示
可以
select * from(
select data.*,row_number()over(partition by ref_id order by rownum)rn
from data)
where rn=1
select id,ref_id,num from tab where refid in(select refid from tab a having count(*)=1 group by a.refid )
2:
select count(distinct ref_id) from tab a
select * from(
select data.*,count(1)over(partition by ref_id)c
from data)
where c=1 2. select count(distinct ref_id) from data