with t1 as (
select 'A1' col1,'V1' col2 union all
select 'A1' col1,'V1' col2 union all
select 'A2' col1,'V2' col2 union all
select 'A3' col1,'V3' col2 union all
select 'A3' col1,'V3' col2 union all
select 'A3' col1,'V3' col2 union all
select 'A4' col1,'V4' col2
),
t2 as (
select 'A1' col1,'V1' col2 union all
select 'A2' col1,'V2' col2 union all
select 'A3' col1,'V3' col2
),
t1_with_rn as (
select t1.*, row_number() over(partition by t1.col1, t1.col2) rn from t1
)
select
t1_with_rn.col1, t1_with_rn.col2
from
t1_with_rn
left join t2 on (t1_with_rn.col1 = t2.col1 and t1_with_rn.col2 = t2.col2 and t1_with_rn.rn = 1)
where
t2.col1 is null and t2.col2 is null
1条答案
按热度按时间5vf7fwbs1#
您可以使用以下方法: