UPDATE HT SET HT.AccessionNo = CONVERT(VARCHAR,HT.HTETKIKID) FROM HTETKIK HT
JOIN HESAPISL ON HESAPISL.HESAPISLID = HT.HESAPISLID
JOIN TITEM ON TITEM.ITEMID = HESAPISL.ITEMID
WHERE TITEM.ITEMKODU2 = '801590'
AND ISNULL(HT.AccessionNo,'') = ''
AND HESAPISL.ITARIH > DATEADD(DAY,-30,GETDATE()) AND HESAPISL.ITARIH< '2019-10-01'