Additional SQL Server features and topics not covered by specific categories
Hi @Harry
A new column changes the query result. This is a normal thing.
Depending on your question, you need to include a 'Group By' in the original query.
How about this query:
select min(id) as id,studentId,max(History) as History,
max(Philosophy) as Philosophy,max(Math) as Math
from StuScore as s
pivot (max(Score) for course in ([History],[Philosophy],[Math])) as t
group by studentId;
Best regards,
Percy Tang