eğer tarih aralığına ilk tarihi eski bir tarih girersem sonuç geliyor
Kod:
SELECT
TBL.GIRIS, TBL.CIKIS, ([TBL].[GIRIS]-[TBL].[CIKIS]) AS KALAN
FROM URUNLER AS SKT
LEFT JOIN (SELECT CLng([URUN_NO]) AS XUrunNo,
Sum(IIf([FIS_TIPI]='Alış' AND [DURUM]='Teslim',IIf(ADET Is Null,0,ADET),0)) AS GIRIS,
Sum(IIf([FIS_TIPI]='Satış' AND [DURUM]='Teslim',IIf(ADET Is Null,0,ADET),0)) AS CIKIS
FROM SIPARISLER SHD
WHERE ((SHD.TARIH)>=#12/01/2022# And (SHD.TARIH)<=#12/01/2022#)
GROUP BY CLng([URUN_NO])) AS TBL ON SKT.URUN_NO = TBL.XUrunNo;
Kod:
SELECT
TBL.GIRIS, TBL.CIKIS, ([TBL].[GIRIS]-[TBL].[CIKIS]) AS KALAN
FROM URUNLER AS SKT
LEFT JOIN (SELECT CLng([URUN_NO]) AS XUrunNo,
Sum(IIf([FIS_TIPI]='Alış' AND [DURUM]='Teslim',IIf(ADET Is Null,0,ADET),0)) AS GIRIS,
Sum(IIf([FIS_TIPI]='Satış' AND [DURUM]='Teslim',IIf(ADET Is Null,0,ADET),0)) AS CIKIS
FROM SIPARISLER SHD
WHERE ((SHD.TARIH)>=#12/01/2021# And (SHD.TARIH)<=#12/01/2022#)
GROUP BY CLng([URUN_NO])) AS TBL ON SKT.URUN_NO = TBL.XUrunNo;