Hi,
I have a database table DbTable containing 3 columns: Key1, Key2, and Value.
Now, in coldfusion, I have created a coldfusion query MyQuery that contains the same 3 columns. After I populate MyQuery with some rows, I would like to upload/insert into DbTable the rows whose 2 keys are not yet in DbTable.
It'll be something like this:
Can anyone help me write a correct query for this problem?
Thank you!
Regards,
Min
I have a database table DbTable containing 3 columns: Key1, Key2, and Value.
Now, in coldfusion, I have created a coldfusion query MyQuery that contains the same 3 columns. After I populate MyQuery with some rows, I would like to upload/insert into DbTable the rows whose 2 keys are not yet in DbTable.
It'll be something like this:
Code:
<cfquery name="insertToDBTable" datasource="myDSN">
insert into DBTable
select MyQuery.*
from MyQuery
where MyQuery.key1 and MyQuery.key2 are not in
(select key1, key2 from DbTable)
</cfquery>
Can anyone help me write a correct query for this problem?
Thank you!
Regards,
Min