Join Question

  • Table A has 4 columns (Starttime, endtime, servername and application name)and one of the columns is servername. Table B has two coumns and one of the column is servername. Servername in table B is a superset of what is in Table A.

    How can get i a report that shows the servers missing from table A.

    No FK/PK relations exist between these two tables. The idea is to capture the servers from table A that havent had applications used.

  • SELECT ServerName

    FROM TableB

    WHERE ServerName NOT IN (SELECT ServerName FROM TableA)

     

    hth

     

    David

  • Wouldn't this work as well, and more efficient?

    SELECT

    a.ServerName

    FROM

    tableA a

    LEFT JOIN tableb b on a.ServerName = b.ServerName

    WHERE

    IsNUll(b.ServerName, '') = ''

    Just a thought....

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply