SELECT  YEAR(F.TARIH)  AS YIL,MONTH(F.TARIH)  AS AY,
 SUM(CASE WHEN D.TUR = 'B' AND (D.GELIRGRUBU = '1') THEN F.BORC ELSE 0 END) AS SatisToplami, 
 SUM(CASE WHEN D.TUR = 'A' AND D.GELIRGRUBU = 0  THEN (F.BORC)*-1 ELSE 0 END)  AS AlınanTahsilatToplam,
 SUM(CASE WHEN D.KODU = '92' AND D.TUR = 'A' THEN (F.BORC)*-1 ELSE 0 END) AS KrediliOteldenCikan, 
 SUM(CASE WHEN D.KODU = '93' AND D.TUR = 'A' THEN (F.BORC)*-1 ELSE 0 END) AS İndirimToplam
FROM FOLYOISL F
LEFT JOIN DEPART D ON DEPT = D.KODU 
 WHERE  (1 = 1)
GROUP BY YEAR(F.TARIH),MONTH(F.TARIH)
UNION
SELECT  YEAR(A.TARIH)  AS YIL,MONTH(A.TARIH)  AS AY,
 SUM(CASE WHEN D.TUR = 'B' AND (D.GELIRGRUBU = '1') THEN A.BORC ELSE 0 END) AS SatisToplami, 
 SUM(CASE WHEN D.TUR = 'A' AND D.GELIRGRUBU = 0  THEN (A.BORC)*-1 ELSE 0 END)  AS AlınanTahsilatToplam,
 SUM(CASE WHEN D.KODU = '92' AND D.TUR = 'A' THEN (A.BORC)*-1 ELSE 0 END) AS KrediliOteldenCikan, 
 SUM(CASE WHEN D.KODU = '93' AND D.TUR = 'A' THEN (A.BORC)*-1 ELSE 0 END) AS İndirimToplam
FROM FOLYOARV A
LEFT JOIN DEPART D ON DEPT = D.KODU 
 WHERE  (1 = 1)
GROUP BY YEAR(A.TARIH),MONTH(A.TARIH)
