I have a table named 'table1' with the columns:
CSMembers,BCID,Total,Email.
The excel sheet contains the data for this table in this format:
CSMembers BCID Total Email
abc 2,5,7,9,12,17,22,32 10,000 [email protected]
xyz 1,3,5,7,9,12,17,20,22,33 12,500 [email protected]
pqr 2,5,7,9,12,17,22,32 11,000 [email protected]
ttt 2,5,7,9,12,17,22 9,800 [email protected]
the .csv file of this is :
CSMembers,BCID,Total,Email
abc,"2,5,7,9,12,17,22,32","10,000",[email protected]
xyz,"1,3,5,7,9,12,17,20,22,33","12,500",[email protected]
pqr,"2,5,7,9,12,17,22,32","11,000",[email protected]
ttt,"2,5,7,9,12,17,22","9,800",[email protected]
I have used the following code:
load data local infile 'H:/abc.csv' into table table1
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\n' ignore 1 lines
(CSMembers,BCID,Total,Email);
I am getting the following output:
CSMember BCID Total Email
abc 2 10 [email protected]
xyz 1 12 [email protected]
pqr 2 11 [email protected]
ttt 2 9 [email protected]
But i need this output:
CSMembers BCID Total Email
abc 2,5,7,9,12,17,22,32 10,000 [email protected]
xyz 1,3,5,7,9,12,17,20,22,33 12,500 [email protected]
pqr 2,5,7,9,12,17,22,32 11,000 [email protected]
ttt 2,5,7,9,12,17,22 9,800 [email protected]
Can anyone please tell me what is wrong? if I should change the code or the csv file content or both? plese help.