Forum Moderators: coopster

Message Too Old, No Replies

Mysql table update command or script help needed

         

smartcard

8:06 pm on Oct 25, 2004 (gmt 0)

10+ Year Member



I have a MySql DB called "CONTACTS" and it has two tables, they are:

Table Name = CUSTOMER [There are many customers in this table]
Field 1 = Customer_Name [Data available]
Field 2 = Customer_Country_Code [Data Available]
Field 3 = Customer_Country_Name [To be updated from COUNTRY table]

Table Name = COUNTRY [There is one record for every country in the world]
Field 1 = Country_Code
Field 2 = Country_Name

How can I run a SQL command or write a PHP script that will fill the CUSTOMER->Customer_Country_Name with the Country Name by checking the CUSTOMER->Customer_Country_Name with COUNTRY->Country_Code

jatar_k

4:57 am on Oct 26, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



is Customer_Country_Code already set for each customer?

if so why pull the name into the other table as well?

smartcard

6:31 am on Oct 26, 2004 (gmt 0)

10+ Year Member



I want it in that way for some other applicaion export.

coopster

12:37 pm on Oct 26, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How about using INSERT ... SELECT [dev.mysql.com] to build the table for export?