I have a statement that looks something like this:
insert table_name(...)
select .... from ... join ...
How can I use where not exists or something of that effect with this insert and select statement so that if this exact code is reran with the same values, it won’t throw an error. I don’t want to have to copy and paste the select/joins in a check as it is a pretty big block of code, so is there any way to do something like
if not exists (insert table_name(...)
select ... from...join)
or would it be something else like
insert table_name(...)
if not exists(select ... from ... join)
Trying to keep this as generic as you did and still have it make sense. Hopefully, this is understandable.
To try to put some more meat on it: