pnr8uk (4/16/2013)
Well it works beautifully so does that mean the productid on the Catalogue table is messed up?The script looks like a thing of beauty and works nicely....
Intrigued now though as to what you mean the productid may be messed up?
Cheers
Paul
It's only a guess Paul, but the productid in the catalogue table seems to be common to several titles when I suspect it shouldn't. You need to check the ERD or ask your DBA.
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