philip.davy (5/16/2013)
Sorry, afraid notthanks
If you are still interested in working it through, there are folks here willing to help.
There are two or three remaining issues with the query;
you have a reference to a table lyrCompletedRecips, in a join, which isn't in the FROMlist
table lyrLookupCompletionStatus isn't joined to any tables in the FROMlist which will result in a cartesian product (too many rows)
the aggregate probably won't generate the result you are expecting.
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