Let's say I have a table with the following information (there could be 40+ unique Measures)
table1
id name state Measure score
1 Joe CA work ethic 40
1 Joe CA cleanliness 80
1 Joe CA helpfulness 70
2 John TX work ethic 70
2 John TX helpfulness 50
3 Jack AZ helpfulness 50
and I would like to combine everyone's measures into separate columns and make the id unique into a new table that would look something like:
table2
id name state workEthicScore cleanlinessScore helpfulnessScore
1 Joe CA 40 80 70
2 John TX 70 null 50
3 Jack AZ null null 50
So, ideally I would like to be able to create this new table without manually typing in all the distinct Measures. How would I go about this using Java and MYSQL? I don't want to use mysql group_concat as I would like to have these as separate columns and not combined into a single column.