MySQL 当记录不存在时insert,当记录存在时update

2018年10月10日 18:59 by:唠吧小站
INSERT INTO clients
(client_id, client_name, client_type)
SELECT 10345, 'IBM', 'advertising'
FROM dual
WHERE not exists (select * from clients
where clients.client_id = 10345);
标签:mysql insert dual