Thread
:
Query - select common data from one column and display in severalcolumns
View Single Post
#
6
(
permalink
)
03-01-2008, 03:49 PM
Plamen Ratchev
Posts: n/a
Re: Query - select common data from one column and display in several columns
Here is a version with the PIVOT operator in SQL Server 2005:
SELECT [name],
SUM([5]) AS note5,
SUM([4]) AS note4
FROM Foo
PIVOT (COUNT(note) FOR note IN ([5], [4])) AS P
GROUP BY [name];
HTH,
Plamen Ratchev
http://www.SQLStudio.com
Plamen Ratchev