[KLUG Members] Data transformation
Andrew Eidson
aeidson at meglink.com
Fri Sep 23 11:13:16 EDT 2005
Hello all..
I am taking data from a SQL database that is long, below is an example..
User_id Field_id Field_value
1 1 data1
1 2 data2
1 3 data3
1 4 data4
2 1 data1
2 2 data2
2 3 data3
2 4 data4
What I need to do is export it but into a wide file so that it looks like
the following
1, data1, data2, data3, data4
2, data1, data2, data3, data4
This will be used for both Postgres databases and MS SQL databases.. my main
question is.. Can this be done with a SQL query or will the data have to be
exported Long and then run through a program/script to change it to the wide
format? Everything I have tried from an SQL stand point has not worked.. but
I am not strong with SQL queries right now.
Thanks
Andrew Eidson
More information about the Members
mailing list