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, a int, b int, c int ); insert into t values ( 8 , 3 , 2 , 1 ), ( 9 , 3 , 2 , 1 ), ( 10 , 4 , 2 , 2 ); with data as (select id, a, b, c, row_number() over (partition by a,b order by id) rn from t ) select id,a, b, c from data where rn = 1;

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

Copy Clear