insert into table where if not in list
- by jim smith
Can anybody help me with the syntax?
insert into history (company,partnumber,price) values ('blah','IFS0090','0.00') if company NOT IN ('blah','blah2','blah3','blah4','blah4') and partnumber='IFS0090';
Background: I have a history table which stores daily company, products and prices. But sometimes a company will remove itself for a few days. Complicating the issue is because I'm only saving daily CHANGES to prices only and not snapshotting the entire days list (the data would be huge) when I display the data the company will still come up for the previous days price. So I need to do something like this, where a 0.00 price means they're no longer there.