jjlbmcnews
IS-IT--Management
I need to generate a number of insert statements using the results of a select statement. Basically I have the following statement -
insert into table1
select table1.column1, value1
from table1
where table1.column2=value2
and table1.column1 not in (select table1.column1
from table1 where table1.column2=value1)
The above query works fine if I manually specify value1 and value2 but I need this to generate the values automatically as I need to do this for several hundred values!
insert into table1
select table1.column1, value1
from table1
where table1.column2=value2
and table1.column1 not in (select table1.column1
from table1 where table1.column2=value1)
The above query works fine if I manually specify value1 and value2 but I need this to generate the values automatically as I need to do this for several hundred values!