only insert new values

Posted on 2012-08-31
Last Modified: 2012-08-31
insert into table2.varcharColumn1 values table1.varcharColumn1 where table2.varcharColumn1 does not exist

I only want to insert new values in this new table
Question by:rgb192
    LVL 142

    Accepted Solution

    this should do:

    insert into table2 (varcharColumn1)
     select t1.varcharColumn1 
       from table1 t1
      where not exists( select null from table2 t2 where t2.varcharColumn1 = t1.varcharColumn1) 

    Open in new window


    Author Closing Comment



    I have a more difficult question that has update

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Read about achieving the basic levels of HRIS security in the workplace.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now