MySQL Forums
Forum List  »  General

Re: Outer join on cartesian product?
Posted by: Arjen Lentz
Date: February 15, 2005 10:55PM

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

Options: ReplyQuote


Subject
Written By
Posted
Re: Outer join on cartesian product?
February 15, 2005 10:55PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.