SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
-- Hint: use Ctrl+Enter for SQL autocomplete create table `groups` ( id int primary key auto_increment, title varchar(255) ); create table clients ( id int primary key auto_increment, username varchar(255), group_id int, foreign key (group_id) references `groups`(id) ); select * from ( select clients.*, groups.title `group`, row_number() over (partition by clients.id order by clients.id) rn -- order may be different from clients join `groups` on groups.id = clients.group_id ) client_groups where rn < 10
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear