What I want to do is not overly complicated (and it works the way I did
it) but I want to find out if it can be done easily using MySQL only.

Table_a: col1, col2, col3
Table_b: col1, col2, col3

Currently, to replace values in col1 in Table_a with values of col2 in
Table_b, I do the following:


     while read col1 col2; do
         echo col1
         echo col2 # so I can see what's happening

         mysql -uuser -ppassword database << eof
         UPDATE Table_a
             SET col1 = "$col2"
             WHERE Table_a.col2 = "$col1"
     eof
     done < Table_b # data from comma delimited file (exported)

I hope that you can see what I am trying to do.  I tried to do the same
thing prior to importing it into MySQL but gave it up.  It was simply
too long to go over two WHILE loops with 1600 and 95000 records
respectively.

So now, I have this kludge where I have glued shell script with MySQL.
How could I accomplish the same in MySQL alone?

Thanks in advance.

--
Bolek,

URL: http://www.bolek.com
URL: http://slash.bolek.com
e-mail: [EMAIL PROTECTED]
ICQ: 4086197, Address: 402905326




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