SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table users (id int, user_id int, a_id int, b_id int); insert into users values (1, 1, 2, 4),(5, 1, 7, 5),(7, 1, 3, 4),(8, 1, 9, 5); select row.user_id, count(*) matches_row_count from users user_row join users row on (user_row.a_id = row.a_id) and (user_row.b_id = row.b_id) and (user_row.id != row.user_id) where user_row.user_id = 1 group by row.user_id;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear