Will this actually work?  Because I can't select from the table into which
I'm inserting.

Also I don't want to insert.  I want to update a bunch of records that
already exist.

Here is exactly what I want to do.

I have two tables set up that I'm dealing with right now.  One is the main
information table, and one is a table that I set up from a filemaker export.
These are tables with information about a bunch of centers our company has,
and the information I'm dealing with will be the sponsors field and the zip
code.

Basically I want to find a record in the export table, and then take the
sponsors info from that row and insert it into the sponsors slot in the
other row in the other table that correspond to the same zip code.

The code I would use is logically like this.  But it seems I can't get the
SQL right.  I do this, and it tells me it can't find my table.

Update tblOrganizations set OrgSponsors = tblCenters.CenterSponsors where
OrgZip like tblCenters. CenterZip;

Any help would really be great. Thanks.

-eric

On 9/10/2001 2:51 PM, "Sheridan Saint-Michel" <[EMAIL PROTECTED]> wrote:
> I think what you are looking for is the Insert...Select statement
> http://www.mysql.com/doc/I/N/INSERT_SELECT.html
> 
> Sheridan Saint-Michel
> Website Administrator
> FoxJet, an ITW Company
> www.foxjet.com
> 
> 
> ----- Original Message -----
> From: "Eric Spletzer" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 10, 2001 4:38 PM
> Subject: Copying data from one table to another.
> 
> 
>> Hello, I'm a newbie, so pardon my lack of wherewithal with MySQL, and
> thanks
>> for the help in advance.
>> 
>> I have two table and I want to copy info from one table to another.  I can
>> pull the correct information out with a select statement that looks
>> something like this
>> 
>> Select x1 from tbl1, tbl2 where y1 = y2
>> 
>> (numbers correspond to different tables)
>> 
>> This returns a table of the info I want to use.  Logically, what I would
>> like to do is:
>> 
>> Update tbl1 set x1 = x2 where y1 = y2;
>> 
>> But this won't work because x1 and x2 are from different tables, as are y1
>> and y2.  However, I've tried including tbl2 in the update parts, and that
>> doesn't work either.  I'm at a loss.
>> 
>> Thanks for any help.
>> 
>> -eric spletzer
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 


---------------------------------------------------------------------
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