Eski Yıl Şirketinde, Yeni yıla ait Efatura ları bulmak
SELECT * FROM TBLEFATURA where SUBSTRING(GIB_FATIRS_NO,4,4)='2017'
SELECT * FROM TBLEFATMAS where SUBSTRING(FATIRS_NO,4,4)='2017'
SELECT * from TBLEFATYANIT where REFZARFID IN (SELECT ZARFID FROM TBLEFATURA where SUBSTRING(GIB_FATIRS_NO,4,4)='2017')
SELECT * FROM TBLEFATZARF WHERE ZARFID IN (SELECT ZARFID from TBLEFATYANIT where REFZARFID IN (SELECT ZARFID FROM TBLEFATURA where SUBSTRING(GIB_FATIRS_NO,4,4)='2017')
)
SELECT * FROM TBLEFATZARF where ZARFID IN (SELECT ZARFID FROM TBLEFATURA where SUBSTRING(GIB_FATIRS_NO,4,4)='2017')
--2016 ÞÝRKETÝNDEKÝ INCKEYNOLARI UPDATE ETME
SELECT EFATINCKEYNO,EF.INCKEYNO,* FROM TBLEFATURA EF LEFT OUTER JOIN TBLEFATMAS MAS
ON EF.GIB_FATIRS_NO=MAS.FATIRS_NO
WHERE SUBSTRING(MAS.FATIRS_NO,4,4)='2016' AND SUBSTRING(GIB_FATIRS_NO,4,4)='2016'
AND EFATINCKEYNO NOT IN (SELECT INCKEYNO FROM TBLEFATURA WHERE SUBSTRING(GIB_FATIRS_NO,4,4)='2016')
UPDATE TBLEFATMAS SET EFATINCKEYNO=EF.INCKEYNO
FROM TBLEFATURA EF LEFT OUTER JOIN TBLEFATMAS MAS
ON EF.GIB_FATIRS_NO=MAS.FATIRS_NO
WHERE SUBSTRING(MAS.FATIRS_NO,4,4)='2016' AND SUBSTRING(GIB_FATIRS_NO,4,4)='2016'
AND EFATINCKEYNO NOT IN (SELECT INCKEYNO FROM TBLEFATURA WHERE SUBSTRING(GIB_FATIRS_NO,4,4)='2016')
--2017 ÞÝRKETÝNDEKÝ 2016 FATURA TARÝHLÝ KAYITLARI BULMA
SELECT * FROM TBLEFATURA where SUBSTRING(GIB_FATIRS_NO,4,4)='2016'
SELECT * FROM TBLEFATMAS where SUBSTRING(FATIRS_NO,4,4)='2016'
SELECT * from TBLEFATYANIT where REFZARFID IN (SELECT ZARFID FROM TBLEFATURA where SUBSTRING(GIB_FATIRS_NO,4,4)='2016')
SELECT * FROM TBLEFATZARF WHERE ZARFID IN (SELECT ZARFID from TBLEFATYANIT where REFZARFID IN (SELECT ZARFID FROM TBLEFATURA where SUBSTRING(GIB_FATIRS_NO,4,4)='2016')
)
SELECT * FROM TBLEFATZARF where ZARFID IN (SELECT ZARFID FROM TBLEFATURA where SUBSTRING(GIB_FATIRS_NO,4,4)='2016')
--2017 ÞÝRKETÝNDEKÝ INCKEYNOLARI UPDATE ETME
SELECT EFATINCKEYNO,EF.INCKEYNO,* FROM TBLEFATURA EF LEFT OUTER JOIN TBLEFATMAS MAS
ON EF.GIB_FATIRS_NO=MAS.FATIRS_NO
WHERE SUBSTRING(MAS.FATIRS_NO,4,4)='2017' AND SUBSTRING(GIB_FATIRS_NO,4,4)='2017'
UPDATE TBLEFATMAS SET EFATINCKEYNO=EF.INCKEYNO
FROM TBLEFATURA EF LEFT OUTER JOIN TBLEFATMAS MAS
ON EF.GIB_FATIRS_NO=MAS.FATIRS_NO
WHERE SUBSTRING(MAS.FATIRS_NO,4,4)='2017' AND SUBSTRING(GIB_FATIRS_NO,4,4)='2017'