I have the following table for students against subjects:
+----------+-------+-----+
|StudentID |Subject|Score|
+----------+-------+-----+
|1011010 |Phy |54 |
+----------+-------+-----+
|1011020 |Phy |78 |
+----------+-------+-----+
|1011010 |Maths |76 |
+----------+-------+-----+
|1011030 |Maths |65 |
+----------+-------+-----+
How do I show the result as a single concatenated string against each student? So,in the above data i should have the following returned:
+---------+---------------+
|StudentID|Result |
+---------+---------------+
|1011010 |Phy-54,Maths-76|
+---------+---------------+
|1011020 |Phy-78,Maths-65|
+---------+---------------+
I am using Sql server 2008.