Results 1 to 3 of 3

Thread: Comparing

  1. #1
    Join Date
    Oct 2003
    Posts
    43

    Red face Unanswered: Comparing

    Seeing as I am not the best with SQL and I was having a big time trouble with this I thought I would come here for some help. I have two tables with names in both two columns and want to update one table with the names of any new names in the other table. I have tried the following code and many versions of such.

    Please help. and yes this is not the best SQL code and thats why I came here.

    Insert Into 2003(Name)SELECT User_Name FROM Qry WHERE (Name FROM 2003)<>(User_Name From Qry)

    Also used the same code cept for UPDATE where Insert Into, and also changed Where statement to a couple other things.

    Thank you for your time.

    Bill

  2. #2
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    Try something like this

    INSERT INTO TableA ( Field1, Field2 )
    SELECT DISTINCT Field1, Field2 FROM TableB LEFT JOIN TableA ON TableB.Field1 = TableA.Field1
    WHERE (((TableA.field1) Is Null))
    ORDER BY TableB.Field1;

  3. #3
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    I would try something like this:

    INSERT INTO 2003 ( Name )
    SELECT Qry.Name
    FROM Qry LEFT JOIN 2003 ON Qry.Name = 2003.Name
    WHERE (((2003.Name) Is Null));

    but I don't know about using a tablename that starts with a number rather than a non-alpha character

Posting Permissions

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