SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table tbl ( id int, code text, number int ); insert into tbl (id, code, number) values (1, 'A', 21), (2, 'B', 23), (2, 'B', 23), (4, 'D', 22), (5, 'E', 25), (6, 'G', 26), (5, 'E', 25); select * from tbl; DELETE T FROM ( SELECT * , DupRank = ROW_NUMBER() OVER ( PARTITION BY key_value ORDER BY (SELECT NULL) ) FROM original_table ) AS T WHERE DupRank > 1

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear