2

Here are my tables :

table1
id_town  town_altitude_min  town_altitude_max
1        NULL               NULL
2        NULL               NULL
...

table2
id_town  id_zipcode
1        1100
2        1100
3        1110
...

And my csv :

id_zipcode;town_altitude_min;town_altitude_max
1100;20;350
1110;243;440
...

How can I update the table1 town_altitude_min and town_altitude_max with the data in the csv file ?

Thanks for all help :)

Kyllak
  • 21
  • 1

1 Answers1

0

You can try this Query and you can find /tmp directory inside result.csv

SELECT table2.id_zipcode, table1.town_altitude_min, table1.town_altitude_max INTO OUTFILE '/tmp/result.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM table1
LEFT JOIN table2 ON table2.id_town = table1.id_town

I hope it will Helps.

NikuNj Rathod
  • 1,663
  • 1
  • 17
  • 26