17,377
社区成员
发帖
与我相关
我的任务
分享
SELECT cardid,COUNT(1) FROM tablename GROUP BY cardid HAVING COUNT(1) > 1;
应该是2条及两条以上吧with temp as
(
select 1 a,2 b,3 c from dual
union all
select 1,2,3 from dual
union all
select 1,3,3 from dual
union all
select 1,3,3 from dual
union all
select 1,3,3 from dual
union all
select 1,5,3 from dual
union all
select 1,6,3 from dual
union all
select 1,7,3 from dual
)
select a,b,c,rn from
(
select a,b,c,count(1) rn from temp a group by a ,b,c having count(1)>1
) b
group by a,b,c