Buda Benden
SELECT CASE(LINETYPE) WHEN 1 THEN 'Promosyon' WHEN 0 THEN 'Malzeme' end 'Türü', STGRPCODE as [Grup], NAME as [Ürün Adı] , SUM(AMOUNT) as [Adet], SUM(LINENET)as [Tutar] FROM LG_008_08_STLINE S INNER JOIN LG_008_ITEMS I ON S.STOCKREF=I.LOGICALREF WHERE S.LINETYPE IN (0,1) AND S.TRCODE=8 AND S.CANCELLED=0 AND S.BILLED=1 GROUP BY LINETYPE, NAME, STGRPCODE ORDER BY SUM(AMOUNT) DESC