• LHendren (8/28/2014)


    Thanks to both of you. All three solutions work for my query.

    Taking this a step further, what if I do not want to see the jNMBR and sNMBR at all when cDate is NULL? In other words, this would be the result:

    jNMBR sNMBR

    7545 1000

    8000 1001

    8011 1003

    9578 1004

    (the jNMBR 8000 sNMBR 1002 row is not shown because cDate is NULL)

    Do you mean "where any cDate is NULL in the set where jNMBR = 8000 and sNMBR = 1002"?

    “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