add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table tbl (t1 int, t2 varchar(10), t3 varchar(10));
insert into tbl (t1, t2, t3) values
(1, '01', 'M6'),
(1, '02', 'M6'),
(2, '01', 'M1'),
(2, '01', 'M1'),
(2, '02', 'M1'),
(3, '04', 'M4'),
(3, '04', 'M4'),
(4, '01', 'M1'),
(4, '01', 'M2');
9 rows affected
with cte as (
select
t1, t2, t3,
ROW_NUMBER() OVER (PARTITION BY t1, t2, t3 order by t1, t2, t3) rn from tbl
)
delete from cte
where rn > 1;
2 rows affected
select * from tbl
t1 t2 t3
1 01 M6
1 02 M6
2 01 M1
2 02 M1
3 04 M4
4 01 M1
4 01 M2