Avoid duplicate entry while using insert into .... select statement

 Avoid duplicate entry while using insert into .... select  statement



       Insert into Names
       select name.Value as name, abr.Value as abr 
       from  name
       INNER JOIN   abr ON name.RowID = abr.RowID
       where NOT EXISTS (select 1
                 from Names a
                 where a.name =name.Value
                 and a.abr = abr.Value)

Comments

Popular posts from this blog

Google to FTS Syntax Cheat Sheet

@@rowcount

Sql Index