FROM ( SELECT ITM.SPECODE Grup ,
ISNULL(STL.VATMATRAH, 0) Sipariş ,
DATENAME(MM, STL.DATE_) AS ay
FROM LG_FIRMA_01_STLINE STL
JOIN LG_FIRMA_CLCARD CL ON STL.CLIENTREF = CL.LOGICALREF
JOIN LG_FIRMA_ITEMS ITM ON STL.STOCKREF = ITM.LOGICALREF
WHERE STL.TRCODE = 8 AND ITM.CARDTYPE=1
) AS x PIVOT
( SUM(SİPARİŞ) FOR ay IN ( [Ocak], [Şubat], [Mart], [Nisan], [Mayıs],
[Haziran], [Temmuz], [Ağustos], [Eylül], [Ekim],
[Kasım], [Aralık] ) ) AS w