INSERT INTO ce1 (`id`, `name`, `display`, `find_inSet`) SELECT a1 FROM ce1 WHERE not exists (select * from ce1 where ce1.name = 'a1') limit 1;//limit 1 重要, 否则会插入多个重复的记录
mysql 如果不存在插入,如果存在不插入
最新推荐文章于 2023-07-20 09:52:39 发布
INSERT INTO ce1 (`id`, `name`, `display`, `find_inSet`) SELECT a1 FROM ce1 WHERE not exists (select * from ce1 where ce1.name = 'a1') limit 1;//limit 1 重要, 否则会插入多个重复的记录