Let's say my database table structure is like :
he haddress hage she saddress sage
Sam USA 25 Jenny germany 21
John UK 32 Anne france 29
keith USA 27 nicole france 21
I want to export this aboce result set into a csv file using this command :
select he, haddress, hage, she, saddress, sage into outfile '/tmp/test1.csv'
fields terminated by ','
lines terminated by '\n' from table_name;
it creates the csv file as following format :
Sam,USA,25,Jenny,germany,21
John,UK,32,Anne,france,29
keith,USA,27,nicole,france,21
now I want the above as below :
Sam,address,USA,age,25,knows,Jenny,address,germany,age,21
.....
.....
.....
how to pass these string while generating the csv file.