数据准备
drop table person;
Create table If Not Exists Person (Id int, Email varchar(255));
Truncate table Person;
insert into Person (id, email) values ('1', 'john@example.com');
insert into Person (id, email) values ('2', 'bob@example.com');
insert into Person (id, email) values ('3', 'john@example.com');
输入
输出
with t1 as (
select *,
row_number() over (partition by Email) rn1
from person
)
select id, email
from t1
where rn1<=1
order by Id
;