I have this query to insert data which is not present inside mytab from temptab
INSERT INTO mytab SELECT * FROM temptab
WHERE NOT EXIST (SELECT * FROM mytab WHERE
(mytab .col1= temptab .col1 AND mytab .col2=temptab .col2))
I want to know if there is any other way of writing this query’s condition part i.e. the last statement.
The above query works absolutely fine but becomes too lengthy when matching many more columns. So I was thinking if there is any kind of format some what like
mytab.(col1,col2,...,coln)=temptab.(col1,col2,...,coln)
I need to match so many columns since combination of these works as primary key for my table.Similary there exist many more tables.
any views appreciated.
P.S. : don’t hesitate to improve the query.
you can write it like this: