SQLTeam.com | Weblogs | Forums

How tu update a Table field by comparison with a csv file

Hello,

1- I have got one MySQL database.

In this database one Table is customer.

The customer Table has several fields.
Two fields are :
- email
- note

Until now, the note field has always been empty.

2- I have also got a csv file from another source.
Such file has two columns :
- email
- code (alphanumeric value)

3- I would like to update the MySQL base by comparison with the csv file, as follows :

When email value is the same in MySQL Table and csv file, Then, I would like to fill the Table note field with the value of the csv code field.

Would anyone know how to do it ?

I thank you in advance for any reply.

Patrick

One Idea is to Import the csv File into database table
join the 2 tables and do the update

Another Idea
is to read the Values of csv file into TEMP Table
and join the temp and other table and do the update

By the way this is T SQL Microsoft SQL Server Forum !!!