I'm using mysql LoadDataLocalFile to enter the data from my csv file to my db. My query works when I don't have to choose any columns but this time I have to.
Suppose I have this content in my csv:
move_doc_number | sku | slot_code | qty| store_id | so_no | date
210 900496 PCK00001 2 20 10472 140509
At the above csv, the only column I want to be inserted in my table is the so_no and move_doc_number
.
And these is my table structure
move_doc_number | so_no
This is my command in loading the csv to my db
$query = "LOAD DATA LOCAL INFILE ".$this->pdo->quote($csv_dir)."
IGNORE
INTO TABLE `$table`
FIELDS TERMINATED BY ".$this->pdo->quote($this->fieldSeparator)."
LINES TERMINATED BY ".$this->pdo->quote($this->lineSeparator) . " " .$columns;
How can I accomplish this?