Home Forums SQL Server 2008 T-SQL (SS2K8) Table Join using unique values or where Null = all values RE: Table Join using unique values or where Null = all values

  • I think maybe you're looking for something like this?

    SELECT DISTINCT *

    FROM(

    SELECT * FROM #TableA

    where Area IS NULL )LL

    FULL OUTER JOIN #TableB CB ON LL.Area = cb.ColId

    LEFT OUTER JOIN (SELECT *

    FROM #TableA a

    JOIN #TableB b ON a.Area = b.ColId)PP

    ON PP.Area = CB.ColId