Re: Exclusive Query

From: Tarang Deshpande (TarangDeshpande_at_discussions.microsoft.com)
Date: 09/10/04

  • Next message: new: "error: when insert into table"
    Date: Fri, 10 Sep 2004 10:13:03 -0700
    
    

    That seems to work well. Now I'd like to add the result back into the second
    table so that table2 ends up like table1.

    I tried:

    INSERT INTO table2 ( id )
    SELECT table1.id FROM table1 WHERE NOT EXISTS
            ( SELECT table2.id FROM table2 WHERE table1.id = table2.id )

    but that doesn't seem to work.

    "Vishal Parkar" wrote:

    > Try:
    >
    > select id from table1 a
    > where not exists
    > (select * from table2 b
    > where a.id = b.id)
    >
    > --
    > Vishal Parkar
    > vgparkar@yahoo.co.in | vgparkar@hotmail.com
    >
    >
    >


  • Next message: new: "error: when insert into table"