INSERT Question (best way to do this)

  • TableOne:

    AcctNo

    A

    B

    C

    TableTwo:

    A

    C

    INSERT INTO TableOne

    (AcctNo)

    SELECT

    AcctNo

    FROM TableTwo

    --WHERE TableOne.AcctNo <> TableTwo.AcctNo  ???

  • INSERT  INTO TableOne (AcctNo)

    SELECT AcctNo

    FROM  TableTwo AS B

    WHERE  NOT EXISTS (SELECT 1 FROM TableOne AS A WHERE A.AcctNo = B.AcctNo)

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply