I have a table
Student Subject Score
Sally Math 98
Sally Reading 96
Billy Science 72
Billy Reading 63
I want a result
Student MathScore ReadingScore
Sally 98 96
Billy null 63
My SQL
Select student,
case when subject=Math then Score else null end as MathScore,
case when subject=Reading then Score else null end as ReadingScore
My result
Student MathScore ReadingScore
Sally 98 null
Sally null 96
Billy null null
Billy null 63
Help?
Student Subject Score
Sally Math 98
Sally Reading 96
Billy Science 72
Billy Reading 63
I want a result
Student MathScore ReadingScore
Sally 98 96
Billy null 63
My SQL
Select student,
case when subject=Math then Score else null end as MathScore,
case when subject=Reading then Score else null end as ReadingScore
My result
Student MathScore ReadingScore
Sally 98 null
Sally null 96
Billy null null
Billy null 63
Help?
Comment