Skip navigation
Ultimatorx
Currently Being Moderated

copying between multiple tables

Aug 3, 2011 7:38 PM

I have some records in tables A  with fields i.e firstname surname, lastname, school, dob

 

I have another table B with some records and fields i.e firstname, surname, address, club,

 

There are some records in table B which exists in table A

I'd like to use the firstname and surname in table B to check if the record exist in table A.

if it doesnt it should append the record to table A.

I would be glad if you can help me with this

 
Replies
  • Jochem van Dieten
    2,389 posts
    Apr 8, 2001
    Currently Being Moderated
    Aug 4, 2011 4:09 AM   in reply to Ultimatorx
    INSERT INTO TableA (firstname, lastname .......)
    SELECT
         firstname
         , lastname
         , ...
    FROM
         TableB
    WHERE NOT EXISTS (
         SELECT *
         FROM TableA
         WHERE
              TableA.firstane = TableB.firstName
              AND TableB.lastName = TableA.lastName
    )
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points