Perhaps you want:

select * from (
       select * from A where x in (subselectA)
       left outer join (
            select * from B where y in (subselectB)
       ) as a
       on -- something
) as A1

  UNION ALL

select * from (
       select * from B where y in (subselectC)
       left outer join (
            select * from A where x in (subselectD)
       ) as b
       on -- something
) as B1

JOIN takes tables (or table-like objects) as operands.  SELECT does not
yield a table unless it's wrapped in parenthesis.

(I generally put UNION in uppercase to make it stand out, lest on a
quick scan it seem like two separate statements.)

Yes that's it. In fact the actual statement is much more complex than the sketch I typed, where I forgot to type the where condition and the outer select. And I got lost in nesting the parenthesis when "simplifying" (i.e. emasculating) my own example.

Thanks for the answers and sorry for the noise. I now have both eyes wide open...

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to