[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sqlite-users
Subject:    Re: [sqlite] How should I use parenthesis?
From:       Darren Duncan <darren () darrenduncan ! net>
Date:       2014-01-28 9:44:00
Message-ID: 52E77BE0.5060205 () darrenduncan ! net
[Download RAW message or body]

On 1/27/2014, 9:57 AM, Jean-Christophe Deschamps wrote:
> 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.

Try something like this, which is a minimal change from yours:

(select * from
(select * from A where x in (subselectA)) dx
left outer join
(select * from B where y in (subselectB)) dy using (...)
)
union all
(select * from
(select * from B where y in (subselectC)) dx
left outer join
(select * from A where x in (subselectD)) dy using (...)
)

... but replace the "using (...)" with a join condition saying which fields you 
want to be used for matching in the join, and also replace the "select *" with a 
specific list of fields you want to match up for the union.

-- Darren Duncan

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic