Select A.*,B.* from A left outer join B on x in (subselectA) and y in (subselectB) Union all Select A.*,B.* from B left outer join A on x in (subselectD) and y in (subselectC)
It seems strange that there is no condition limiting which rows from A and B match, which makes the LEFT OUTER JOIN rather pointless... -----Ursprüngliche Nachricht----- Von: Jean-Christophe Deschamps [mailto:j...@antichoc.net] Gesendet: Montag, 27. Jänner 2014 18:57 An: sqlite-users@sqlite.org Betreff: [sqlite] How should I use parenthesis? Dear list, I'm trying to find the correct syntaxt for this, but I hit a syntax error each time: either SQLite shokes on outer parenthesis or on union all. ( select * from A where x in (subselectA) left outer join select * from B where y in (subselectB) ) union all ( -- <-- error select * from B where y in (subselectC) left outer join select * from A where x in (subselectD) ) Union [all], except, intersect don't seem to accept parenthesis around the left or right parts. Of course a workaround could be to create two views then union all them, but there must be a way to express this construct in a single statement. I don't want the statement to be interpreted this way: select * from A where x in (subselectA) left outer join ( select * from B where y in (subselectB) union all select * from B where y in (subselectC) ) left outer join select * from A where x in (subselectD) -- jcd _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -------------------------------------------------------------------------- Gunter Hick Software Engineer Scientific Games International GmbH Klitschgasse 2 – 4, A - 1130 Vienna, Austria FN 157284 a, HG Wien Tel: +43 1 80100 0 E-Mail: h...@scigames.at This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice as to its status and accordingly please notify us immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any person as to do so could be a breach of confidence. Thank you for your cooperation. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users