I don't know what you are trying to accomplish but here is the way I would
build a table using ALL the data field from two tables.   first is a
straight join which will only build the records that have an equal in both
tables.

insert into tbla select distinct tblb.*, tblc.* from tblb, tblc where
tblb.flda = tblc.flda


the second will build records for every record in tblb and will include data
from tblc when there is a corresponding record in tblc.   When there is no
corresponding record in tblc the tblc data fields will be set to null.

insert into tbla select distinct tblb.*, tblc.* from tblb left join tblc on
tblb.flda = tblc.flda

hope this helps.

Jack  :-)=
----- Original Message -----
From: "Willie Klein" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 06, 2001 2:20 PM
Subject: Join syntax


> Hi all:
> I think what I want to do is join tables in a select statement but I'm not
> having any luck.
> I'm using MySQL 3.22 PHP and apache on RH6.2
> I have an application that has multiple tables that customers upload order
> data to.  People who look at this data can see their orders from each
table
> individually.  Now they want to download their data from each of these
> tables into their own database.
>  When I do a select on my test table like:
> Select * into outfile /home/temp/test.txt from apple where RepID = NYS  I
> get a file that is 150K.
> When I do a select on 2 of my test tables(which are identical)like:
> Select * into outfile /home/temp/test.txt from apple as t1, bass as t2
where
> t1.RepID = 'NYS' and t2.RepID='NYS'
> I get a file that is 116MB with each record being repeated 866 times. When
I
> do a left join it does about the same thing.  I'm going to want to do this
> with more than 2 tables so is my approach to this wrong or just my syntax.
> I've read the manual page on join and (I admit it) I don't understand it.
> Thanks for your help
> willie
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to