Lowell (6/14/2016)
it also looks to me like you could combine the WHERE statement into a single query, that might be more efficient too:aww nevermind, i didn't notice the IS NOT NULL in the first, but not the second....
still left the code for my ideal, even though it is WRONG.
where
enc.ADT_PAT_CLASS_C IN( '103','101')
and
enc.adt_arrival_time between dateadd(dd,-180,cast(getdate() as date)) and cast(getdate() as date)
and
enc.ed_episode_id is not null
Also, the date-range depends on the 103 or 101.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon