conditional insert with values; insert into .. values(...) where not exist (....);
From: md <mardahl2000_at_yahoo.com>
Date: Tue, 29 Apr 2008 08:08:52 -0700 (PDT)
Message-ID: <7ac27985-d907-49bf-b7b5-2ed11dd79696@z72g2000hsb.googlegroups.com>
Date: Tue, 29 Apr 2008 08:08:52 -0700 (PDT)
Message-ID: <7ac27985-d907-49bf-b7b5-2ed11dd79696@z72g2000hsb.googlegroups.com>
This is what I wish I could to do.
insert into table_x (a, b, c)
values(1, 2, 3)
where not exist (select * from table_x where a = 2);
Thank you.
additional info:
I've seen conditional inserts without values(....), as in
INSERT INTO clients
(client_id, client_name, client_type)
SELECT supplier_id, supplier_name, 'advertising'
FROM suppliers
WHERE NOT EXISTS (SELECT *
FROM clients WHERE clients.client_id =suppliers.supplier_id); Received on Tue Apr 29 2008 - 10:08:52 CDT