• inevercheckthis2002 (6/20/2013)


    Jan Van der Eecken (6/19/2013)


    Just OUTER JOIN tableA, tableB and tableC on id_number.

    Point of clarification -- sometimes data will be entered in TableA and not in TableB or TableC. We do not want the rows from TableA unless there is matching data in TableB and/or TableC.

    My understanding is that an outer join would return all rows from TableA.

    Quite simple. Add a WHERE clause to the query provided by Sean.

    SELECT A.id_number, B.notes, B.status, C.location, C.item

    FROM TableA as A

    LEFT JOIN TableB as B ON A.id_number = B.id_number

    LEFT JOIN TableC as C ON A.id_number = C.id_number

    WHERE B.is_number IS NOT NULL OR C.id_number IS NOT NULL


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/