How to insert a record to a table if there is no data exist of same type
insert into user_table (userid, active,contid) values ('AAA',1,1);
insert into user_table (userid, active,contid) values ('ABA',1,2);
INSERT INTO new_table(userid,isactive)
SELECT userid,1
FROM user_table where contid=1
WHERE NOT EXISTS (SELECT userid
FROM new_table
WHERE contid=1
)
i need to copy data from one table1 to table2 if table2 doesnt have the same data. if data exist just skip and dont make any insert. I am getting "SQL command not properly ended" error with the above query