SELECT id, [0], [1], [2] FROM (SELECT id, [type] FROM mytable) AS src PIVOT (COUNT([type]) FOR [type] IN ([0],[1],[2])) AS pvt
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)