我在table.i中有3列a,b,c需要找到列a&列的重复项。 b但在c栏中具有不同的值。
答案 0 :(得分:1)
也许你需要这样的东西:
with test(a, b, c) as (
select 1, 2, 10 from dual union all
select 1, 2, 20 from dual union all
select 4, 5, 30 from dual union all
select 4, 5, 30 from dual union all
select 3, 2, 3 from dual union all
select 6, 2, 2 from dual
)
select a, b
from test
group by a,b
having count(distinct c) > 1
也就是说,您需要汇总A,B
,但只保留列DISTINCT
C
值更多的对