Conditional INSERT INTO statement in postgres
That specific command can be done like this: insert into LeadCustomer (Firstname, Surname, BillingAddress, email) select ‘John’, ‘Smith’, ‘6 Brewery close, Buxton, Norfolk’, ‘cmp.testing@example.com’ where not exists ( select 1 from leadcustomer where firstname=”John” and surname=”Smith” ); It will insert the result of the select statement, and the select will only return a row if … Read more