I’ve searched StackOverflow and google for quite some time now and haven’t been able to find an answer even remotely close to my desired solution using SQL. I have a CSV file (1 table) and it has data for numerous users. The problem is each user has multiple rows with multiple scores but same UserID. I would like to move those scores into their own column to present one row with all of the user’s data. How can I achieve this using SQL?
Example of Current Layout:
UserID FNm LNm Measure Score
0001 person one LNF 26
0001 person one NFS 74
0001 person one CFS 54
0002 person two LNF 35
0002 person two NFS 43
0002 person two CFS 33
Desired solution:
UserID FNm LNm LNF NFS CFS
0001 person one 26 74 54
0002 person two 35 43 33
First, insert all records as is into some temporary table.
Second, insert combined data into needed table; select part is about: