我想说的是:“如果 RC.Expiration 大于或等于今天的日期并且 RC.DemoLicense 等于 0,则将 DemoTracking.Purchased 设置为 1”我只需要查看 DT.Purchased 为 0 的条目.
update WebCatalog.Published.DemoTracking
set Purchased = 1
from WebCatalog.Published.RCompany RC
inner join WebCatalog.Published.DemoTracking DT
on RC.Link = DT.RCompanyLink and DT.Purchased = 0
where RC.Expiration >= GETDATE() and RC.DemoLicense = 0