Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
join tables multiple columns
DROP TABLE place; DROP TABLE Post; CREATE TABLE place ( std_id INT, sch_id INT); INSERT INTO place( std_id, sch_id) VALUES (1 , 1), (2 , 2), (3 , 1), (4 , 3), (5 , 4), (6 , 2), (7 , 5), (8 , 3), (9 , 5), (10, 4); CREATE TABLE Post( sch1_id INT, sch2_id INT, sch3_id INT, sup_id INT); INSERT INTO Post (sch1_id, sch2_id, sch3_id, sup_id) VALUES (1, 2, 3, 1), (3, 2, 4, 2); SELECT po.sup_id, po.sch_id, pl.std_id FROM `place` pl JOIN ( SELECT sch1_id AS sch_id, sup_id FROM `post` UNION ALL SELECT sch2_id AS sch_id, sup_id FROM `post` UNION ALL SELECT sch3_id AS sch_id, sup_id FROM `post` ) AS po ON pl.sch_id = po.sch_id ORDER BY po.sup_id, po.sch_id, pl.std_id
run
|
edit
|
history
|
help
0
Show databases;
Point System Alpha
PBD
ebac_brms_bus_Details
akshay dbms query
Funciones Cadena
Funciones suma fechas MySQL
Legitimate Resale
proyecto
practice