SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE recipients ( id INT, mobile_number varchar(20), deleted datetime ); INSERT INTO recipients (id,mobile_number) VALUES (1,'+420777150000'); INSERT INTO recipients (id,mobile_number) VALUES (2,'+420777150001'); INSERT INTO recipients (id,mobile_number) VALUES (3,'+420777150002'); INSERT INTO recipients (id,mobile_number) VALUES (4,'+420777150003'); INSERT INTO recipients (id,mobile_number) VALUES (5,'+420777150004'); INSERT INTO recipients (id,mobile_number) VALUES (6,'+420777150005'); INSERT INTO recipients (id,mobile_number) VALUES (7,'+420777150006'); INSERT INTO recipients (id,mobile_number) VALUES (8,'+420724307770'); INSERT INTO recipients (id,mobile_number) VALUES (9,'+420724307770'); INSERT INTO recipients (id,mobile_number) VALUES (10,'+420724307770'); UPDATE recipients r1 JOIN recipients r2 ON r1.id > r2.id AND r1.mobile_number = r2.mobile_number SET r1.deleted = NOW(); SELECT * FROM recipients;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear