Another sql to csv question
Posted: Mon May 25, 2009 9:20 pm
SQL output:
name|qty|week
abc|60|1
abc|20|2
abc|80|3
abc|22|4
bfg|23|1
bfg|45|2
bfg|633|3
bfg|90|4
jhg|34|1
jhg|23|2
jhg|20|4
I need to generate the csv file like this:
week,abc,bfg,jhg
1,60,23,34
2,20,45,23
3,80,633,, <<<< notice no data for jhg in week 3.
4,22,90,20
I had received a great response in previous thread by using arrays but this time I am not sure how to get it in this particular format. Will associative array help?
Thanks
Alex B
name|qty|week
abc|60|1
abc|20|2
abc|80|3
abc|22|4
bfg|23|1
bfg|45|2
bfg|633|3
bfg|90|4
jhg|34|1
jhg|23|2
jhg|20|4
I need to generate the csv file like this:
week,abc,bfg,jhg
1,60,23,34
2,20,45,23
3,80,633,, <<<< notice no data for jhg in week 3.
4,22,90,20
I had received a great response in previous thread by using arrays but this time I am not sure how to get it in this particular format. Will associative array help?
Thanks
Alex B