Help with a simple query please

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chudson007@hotmail.com

    Help with a simple query please

    I have Two Tables, TableA and TableB, both containing a common field,
    Feild1.

    How do I find all records in TableA, where Field1 is not in TableB?


    Regards,
    Ciarán

  • David Portas

    #2
    Re: Help with a simple query please

    SELECT A.*
    FROM TableA AS A
    LEFT JOIN TableB AS B
    ON A.col1 = B.col1
    WHERE B.col1 IS NULL

    --
    David Portas
    SQL Server MVP
    --

    Comment

    • Ryan

      #3
      Re: Help with a simple query please

      Try

      SELECT
      A.*

      FROM
      TableA A
      LEFT JOIN TableB B ON
      A.Field1 = B.Field1

      Comment

      • Ryan

        #4
        Re: Help with a simple query please

        Sorry, didn't read it properly. David's answer is correct.

        Comment

        Working...