www.webdeveloper.com
Results 1 to 4 of 4

Thread: Select * from Table where record doesn't exist in other table

  1. #1
    Join Date
    Jul 2006
    Posts
    146

    Select * from Table where record doesn't exist in other table

    Hi,

    I have two tables, each with a similar field.

    The first table has priority, so I take all the values from there and put them into a temp table. (select * from table1 where criteria).

    Then, I want to get the critera for table2, but not where the samefield value is already in my temptable (select * from table2 if sameField is not in tempTable)

    I have tried many solutions, but this is eluding me.

    Is this possible to do?

  2. #2
    Join Date
    Feb 2003
    Posts
    2,745
    Code:
    SELECT fieldList
    FROM    TableA a
    LEFT JOIN
          TableB b
    On  a.keyField = b.keyField
    WHERE b.keyField is NULL

  3. #3
    Join Date
    Jul 2006
    Posts
    146
    Thank you, that was it exact. LEFT JOIN

  4. #4
    Join Date
    Feb 2003
    Posts
    2,745
    very welcome. happy to help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles