#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    44
    Rep Power
    15
    Very similar to selecting only those values in table1 that exist in table2 also, I want to select all those that exist in table1 but NOT in table 2.

    I have no clue how to do this. I tried:

    select table1.ID from table1, table2 where table1.ID <> table2.ID

    but that does not work because it simply returns the rows in the reversed order.

    select table1.ID from table1, table2 where table1.ID = table2.ID works for the opposite effect. (finding all rows where the value is same in the first and second table)
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Here is the sql for you..


    SELECT table1.id FROM table1 LEFT JOIN table2 ON table1.id=table2.id where table2.id IS NULL


    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited October 13, 2000).]

Similar Threads

  1. select verification onsubmit
    By DrStein in forum HTML Programming
    Replies: 3
    Last Post: January 20th, 2004, 03:16 AM
  2. Replies: 4
    Last Post: December 8th, 2003, 10:57 AM
  3. Help with javascript, passing multiple select array to js then php
    By zen^Wallhack! in forum JavaScript Development
    Replies: 1
    Last Post: December 3rd, 2003, 01:56 PM
  4. Replies: 2
    Last Post: December 2nd, 2003, 03:06 AM
  5. Help with function to copy contents of select item
    By MilesDependent in forum HTML Programming
    Replies: 2
    Last Post: November 23rd, 2003, 06:16 PM

IMN logo majestic logo threadwatch logo seochat tools logo