Copying from one table to another.

2001-09-12 Thread Eric Spletzer

Hello,

I'm new to MySQL, so forgive my ignorance.

I'd like to copy data from one table to another.

I have one table I've made from a filemaker database.
And one that contains my main data.

I want to update the main data from the Main file using the data from the
filemaker file.  Each row has a unique zip code, and the zip code is in each
of the files, so I thought I'd use that as an index field, but with no luck.

What I've tried so far is this, and it doesn't see to work.

Update tbl1 set CategoryInTable1 = CategoryInTable 2 where ZipInTable1 =
ZipInTable2;

I've also tried:

Update tbl1, tbl2 set CategoryInTable1 = CategoryInTable 2 where ZipInTable1
= ZipInTable2;and
Update tbl1, tbl2 set tbl1.CategoryInTable1 = tbl2.CategoryInTable 2 where
tbl1.ZipInTable1 = tbl2.ZipInTable2;

I thought to do an Insert-Select, but I can't since I want to update the
table I'm selecting from.

Any help would really be appreciated.  Thanks.

-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




Re: Copying from one table to another.

2001-09-12 Thread Kevin Kotun



I obviously dont know what the error message is but

Update tbl1, tbl2 set tbl1.CategoryInTable1 = tbl2.CategoryInTable 2 where
  ^
  |
This space may be a problem

good luck, 

try to provide the error message

-- kevin

-
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