SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table test ( id serial, type varchar(25), role tinyint ) engine=innodb; insert into test values (1, 'first', 1), (2, 'second', 1), (3, 'first', 2), (4, 'second', 3), (5, 'second', 5), (6, 'second', 3); select * from test where role in ( select role from test group by role having count(distinct type) = 1 );
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear