Home Forums SQL Server 2008 T-SQL (SS2K8) Show all data from four tables joined or matched on a particular column RE: Show all data from four tables joined or matched on a particular column

  • Thanks to all those who replied.

    bitbucket-25253, I would like to give you more but two of the four are not actual tables exactly. One is a call to Active Directory. Another is from an Excel Spreadsheet. Yet another is from a view in SCCM and lastly one is from a table from another server?

    A computer should have a record in all of the above. I am trying to find computer names that don't exist in one or more of these data sources. full outer joins seemed logical and I think I have found the answer after some initial testing. Further testing later this week will hopefully prove me correct.

    LutzM, ScottPletcher.

    Thank you. I was looking at Full Outer Join and finally found that I needed more than one join definition. (if thats what it is called) I of course want to fully test with some dummy data to prove why but at the moment the results look correct.

    If a device is missing from any of the tables a row is returned showing Null where the device is missing from.

    Suedo Code

    Table1

    full outer join

    Table2

    on table1.computername = table2.computername

    full outer join table3

    on table1.computername = table3.computername

    or table2.computername = table2.computername

    full outer join table4

    on table1.computername = table4.computername

    or table2.computername = table4.computername

    or table3.computername = table4.computername

    where table1.Name is null

    or table2.name is null

    or table3.name is null

    or table4.name is null