select stok =(select count(*) from tblstsabit), stokek =(select count(*) from tblstsabitek), stokfark =(select count(*) from tblstsabit)-(select count(*) from tblstsabitek), cari =(select count(*) from tblcasabit), cariek =(select count(*) from tblcasabitek), carifark =(select count(*) from tblcasabit)-(select count(*) from tblcasabitek), muh =(select count(*) from tblmuplan), muhek =(select count(*) from tblmuplanek), muhfark =(select count(*) from tblmuplan)-(select count(*) from tblmuplanek), stok1 =(select count(*) from tblstsabit), cari1 =(select count(*) from tblcasabit), caristok =(select count(*) from tblcaristok), stokcaritop =(select count(*) from tblstsabit)+(select count(*) from tblcasabit), caristokFark =(select count(*) from tblstsabit)+(select count(*) from tblcasabit)-(select count(*) from tblcaristok)
INSERT INTO TBLSTSABITEK(STOK_KODU,KAYITTARIHI,KAYITYAPANKUL) SELECT STOK_KODU,GETDATE(),'NETSIS' FROM TBLSTSABIT WHERE NOT STOK_KODU IN(SELECT STOK_KODU FROM TBLSTSABITEK)
INSERT INTO TBLcaSABITEK(cari_kod,KAYITTARIHI,KAYITYAPANKUL) SELECT cari_kod,GETDATE(),'NETSIS' FROM TBLcaSABIT WHERE NOT cari_kod IN(SELECT cari_kod FROM TBLcasABITEK)
INSERT INTO TBLmuplanek(kod,KAYITTARIHI,KAYITYAPANKUL) SELECT hesap_kodu,GETDATE(),'NETSIS' FROM TBLmuplan WHERE NOT hesap_kodu IN(SELECT kod FROM TBLmuplanEK)
INSERT INTO TBLcaristok(stok_kodu,caristok_kodu,KAYITTARIHI,KAYITYAPANKUL,sube_kodu,isletme_kodu) SELECT stok_kodu,stok_kodu,GETDATE(),'NETSIS','0','1' FROM TBLstsabit WHERE NOT stok_kodu IN(SELECT stok_kodu FROM TBLcaristok where stok_kodu is not null)
INSERT INTO TBLcaristok(cari_kod,KAYITTARIHI,KAYITYAPANKUL,sube_kodu,isletme_kodu) SELECT cari_kod,GETDATE(),'NETSIS','0','1' FROM TBLcasabit WHERE not cari_kod IN(SELECT cari_kod FROM TBLcaristok where cari_kod is not null)
select stok =(select count(*) from tblstsabit), stokek =(select count(*) from tblstsabitek), stokfark =(select count(*) from tblstsabit)-(select count(*) from tblstsabitek), cari =(select count(*) from tblcasabit), cariek =(select count(*) from tblcasabitek), carifark =(select count(*) from tblcasabit)-(select count(*) from tblcasabitek), muh =(select count(*) from tblmuplan), muhek =(select count(*) from tblmuplanek), muhfark =(select count(*) from tblmuplan)-(select count(*) from tblmuplanek), stok1 =(select count(*) from tblstsabit), cari1 =(select count(*) from tblcasabit), caristok =(select count(*) from tblcaristok), stokcaritop =(select count(*) from tblstsabit)+(select count(*) from tblcasabit), caristokFark =(select count(*) from tblstsabit)+(select count(*) from tblcasabit)-(select count(*) from tblcaristok)
------------- Netsisden vazgeçemiyorum. Beni engelliyor..
|