how to check the value exist before insert?
INSERT INTO DeliveryOrder (ContactName, ContactID) VALUES ('Andy', (SELECT ContactID FROM Contact WHERE ContactName = 'Andy'))
I want to verify whether the ContactID is exist before insert the record.
Had try below but not working:
INSERT INTO DeliveryOrder (ContactName, ContactID) VALUES ('Andy', (SELECT ContactID FROM Contact WHERE ContactName = 'Andy')) WHERE IF Exists (SELECT ContactID FROM Contact WHERE ContactName = 'Andy')
INSERT OR REPLACEorINSERT OR IGNOREto be useful (see SQLite docs).