jsayerweb (1/29/2014)
Hello,Thankyou for the bottom solution, it seems to work well, there are just a few instances were there is still a null start date and null end date. Its turns out that only a status of 'nfa' can be applied therefore closing the referal thus giving us no start date to play with. We can how ever use a field in the referral table 'refstartdate' as the start date?
Could this be built into the query suggested?
and just focus on the end date issue?
Cheers
Jon
Hi Jon
Can you modify the sample data to reflect this please? Use Gail's cut and add a few extra rows. If you can set up a table of expected results too please, that would be very helpful.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden