Inactivate customers that have not been invoiced in xx days

declare @dt date = dateadd(m,-6,getdate())
 
 
--update rm00101 set inactive = 1
select c.custnmbr, c2.custnmbr
    from rm00101 c
        left join (
            select distinct custnmbr from rm20101 where docdate > @dt
            union           select distinct custnmbr from rm30101 where docdate > @dt
        ) c2 on c2.custnmbr = c.custnmbr
    where c2.CUSTNMBR is null
        and inactive = 0

RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences