Nick Roper wrote:
> OK, I really ought to know the answer to this, but it's Friday afternoon and my head is hurting ;-)
>
> What I want to do is to execute an outer join against a cartesian product of two other tables.
> I've done it with two statements and a temporary table, but I'm sure it ought to be possible in one
> statement:
>
> So, suppose I have three tables 'a','b' and 'c'
>
> First I want the cartesian product of b & c:
Ugh.
> select (columns) from b,c;
>
> Then, I want to implement a left join from 'a' against the rowset generated by the cartesian
> product, e.g. in pseudo-code:
>
> select (columns)
> from 'a' left join ('b','c')
> on (condition);
SELECT ... FROM b,c LEFT JOIN a ON (condition) ...
Regards, Arjen.
--
Arjen Lentz, Exec.Director @ Open Query (http://openquery.com)
Remote expertise & maintenance for MySQL/MariaDB server environments.
Follow us at
http://openquery.com/blog/ &
http://twitter.com/openquery