If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Load Data Infile ... Update

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-16-04, 18:36
fryguy5049 fryguy5049 is offline
Registered User
 
Join Date: Sep 2004
Posts: 1
Load Data Infile ... Update

Running MySQL 4.0. I have a table that needs to be updated on regular basis. For example if there are 2 columns in my table- ID and AMOUNT, I then have a .csv file that I want to use the infile command to update. I want it to verify that the ID fileds match from both the table and the .csv file. If they match I want the AMOUNT field updated with the AMOUNT data from the .csv file. I don't want any new records creted and if there are no matches then no changes should be made. Any ideas?
Reply With Quote
  #2 (permalink)  
Old 09-16-04, 20:47
sundialsvcs sundialsvcs is offline
Registered User
 
Join Date: Oct 2003
Posts: 706
Load the data from the file into a table, then use separate SQL queries or a short program to update the master from this table.

Each import completely replaces the previous content of the import-table.
__________________
ChimneySweep(R): fast, automatic
table repair at a click of the
mouse! http://www.sundialservices.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On