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 t1 ( GroupLeader int, ClientID int, GroupID varchar(32) ); insert into t1 values (1027158233, 1027158233, 'K34K89WD5OY0'), (1027158233, 1817027294, 'K34K89WD5OY0'); create table t2 (ID_GR int, ID_KL int); insert into t2 values (1027158233, 23221101), (1027158233, 1817027294); select t1.*, t2.* from t1 left join t2 on t1.GroupLeader = t2.ID_GR and t1.ClientID = t2.ID_KL union select t1.*, t2.* from t2 left join t1 on t1.GroupLeader = t2.ID_GR and t1.ClientID = t2.ID_KL order by GroupLeader desc, ClientID desc;

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

Copy Clear