Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
create table t ( id int primary key, v int ); insert into t(id, v) values (1, 1),(2, 1),(3, 2),(4, 2),(5, 1),(6, 1),(7, 2),(8, 3),(9, 2),(10, 4),(11, 3); select * from t; DELETE t1.* FROM t t1, (SELECT MIN(t2.id) mid, t2.v FROM t t2 GROUP BY t2.v) t3 WHERE t1.v = t3.v AND t1.id > t3.mid SELECT * FROM t;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear