== Quote from dcruzjr (
dcruzjr@gmail.com)'s article
> Hello folks,
> Is it possible to update a column using LOAD DATA INFILE, So the
> following is an example:
> LOAD DATA LOCAL INFILE 'c:/test.txt'
> INTO TABLE test
> FIELDS TERMINATED BY ','
> LINES TERMINATED BY '\n'
> (lname, fname, zip);
> Results:
> id | fname | lname | zip
> 1 | kurt | russell | 45678
> 2 | worth | tim | 45687
> 3 | ridd | sherly | 45698
> Now, I would like to load a file into the test table to replace only
> the zip column with the following:
> LOAD DATA LOCAL INFILE 'c:/test.txt'
> REPLACE INTO TABLE test
> FIELDS TERMINATED BY ','
> LINES TERMINATED BY '\n'
> (zip);
> But the above query removes the current data and sets only the zip and
> removes id, fname, lname. I would like it to update the zip column
> only. Is it possible?
> Thank you,
> Dan
how about this:
LOAD DATA LOCAL INFILE 'c:/test.txt'
REPLACE INTO TABLE test (id, @dummy, fname, @dummy, lname, @dummy, zip)
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n';
--
POST BY: lark with PHP News Reader