Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Location
    Japan/California
    Posts
    68

    Question Unanswered: Quick SELECT question (comparing tables)

    Quick question:

    how can i make this sql statement:

    SELECT table1.field1, table1.field2 FROM table1 WHERE field1 DOES NOT EQUAL table2.field1

    basically i want to only select records from table1 that do not exist in table2

    any help will be greatly appreciated,
    thanks in advance,

    Jonah

  2. #2
    Join Date
    Jul 2003
    Location
    Japan/California
    Posts
    68

    Lightbulb Re: Quick SELECT question (comparing tables)

    OK then,

    ill answer this myself:

    SELECT [table1].[field1] FROM table1 WHERE NOT EXISTS (SELECT * FROM table2 WHERE [table2].[field1] = [table1].[field1])

    hope this helps

  3. #3
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    you could also do....

    SELECT [table1].[field1] FROM table1
    WHERE Table1.field1 NOT IN (SELECT [table2].Field1 FROM table2)

    hope this helps

  4. #4
    Join Date
    Jul 2003
    Location
    Japan/California
    Posts
    68

    Thumbs up

    thanks rokslide,

    that looks like a good option as well.

    Jonah

Posting Permissions

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