Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Can someone help me with this?
SELECT Count(1) AS Expr1 FROM (select distinct PatientsID, iif(datediff('d', End, nz(next_service,End))>30, 1, 0) as MoreThan30 from ( SELECT P1.PatientsID, P1.EffectiveFrom, P1.End, (select min(EffectiveFrom) from TmpPatBillingCodes as P2 where P2.PatientsID=P1.PatientsID and P2.EffectiveFrom > P1.End) AS next_service FROM TmpPatBillingCodes AS P1 INNER JOIN Patients3 ON P1.PatientsID = Patients3.ID WHERE (((Patients3.FacilityID)<>6488) AND ((P1.EffectiveFrom)<#1/1/2014#) AND ((P1.End)>=#1/1/2013#)) ) as x ) AS y;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.