UPDATE Properties pr SET pr.propstatus = 'TOLET', pr.status=4, pr.AvailableFrom = null where (select count(*) from owners where owners.id=pr.OwnerId) > 0 AND pr.PropStatus = 'LET' AND (SELECT count(*) from Lettings inner join owners on Lettings.tenantid1 = owners.keyid where Lettings.propId=pr.propId )>0 AND (SELECT count(*) from Lettings inner join owners on Lettings.tenantid1 = owners.keyid where Lettings.propId=pr.propId and Lettings.isbreached = False AND (Lettings.EndDate >= now() OR IIF(ISNULL(Lettings.renew_at_expire),'',Lettings.renew_at_expire) ='yes') )=0

Applicants need check = 0
0 23/08/2019 16:56:01

Smartrix Scheduler cron