MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Jules Bean Date:September 5 1999 11:10pm
Subject:Re: Multi-table outer join query question
View as plain text  
Erik Stewart wrote:
> Hi,
> I'm new to SQL.
> I'm trying to create multiple table queries.  For example:
> select * from
> (marketers union join techs)
> left outer join companies on (companies.employee = name));
> According to the SQL-book I'm using, this should print out all employees
> whether they're company is known or not (actually this database shows
> poor relational design, but that's another issue).

MySQL doesn't support UNIONs, so you can't do this, as you have
realised.  Union support is coming.  (At least, I assume that 'union
join' is unions...)

> It seems MySQL doesn't support this syntax.  How can I put together a
> request like this?

Temporary tables, unfortunately.

> One thing I thought of was creating a temporary table with the first part
> of the query and then doing a second query on the table.  Is this the
> best way to do multiple table queries?

No, it's the worst way :-)  But it's the only way at the moment, since
MySQL doesn't yet support joins.

> And how do I create a table with a query statement?

Have a look in the manual.  Specifically, CREATE TABLE and CREATE


|  Jelibean aka  | jules@stripped         |  6 Evelyn Rd        |
|  Jules aka     |                               |  Richmond, Surrey   |
|  Julian Bean   | jmlb2@stripped        |  TW9 2TF *UK*       |
|  War doesn't demonstrate who's right... just who's left.             |
|  When privacy is outlawed... only the outlaws have privacy.          |
Multi-table outer join query questionErik Stewart6 Sep
  • Re: Multi-table outer join query questionJules Bean6 Sep