Bhuvnesh (1/11/2010)
sample data is not possible , as it includes amny tablesyes row count is correct and time taken = 18 secs
but my concerns is UNION ALL with same tables
i want to replace it with correlated query.
The row count is correct: are there any differences between the results of your first query and my query?
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