SELECT * FROM tablename PIVOT ( sum(amount) FOR month IN ([jan],[feb]) )AS somename
SELECT SUM(A.JAN)AS JAN,SUM(A.FEB)AS FEB FROM ( SELECT CASE WHEN [month]='jan' THEN amount ELSE 0 END AS JAN, CASE WHEN [month]='feb' THEN amount ELSE 0 END AS FEB FROM dbo.tbl1)AS A
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)