• karim.boulahfa (5/22/2013)


    I dont get any valuas out the Query ??

    It's very difficult to rework someone else's code without data to run the code against. That's why I wrote "Something like this", because I can't run the code to verify it. You will have to experiment with it to find out why no results are returned. Try running the inner query, try commenting out any filters. This shouldn't cost you more than a few seconds of your time.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    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