日期:2014-05-16 浏览次数:20631 次
create table insertTest(id int(4),name varchar(12)); insert into insertTest values(100,'liudehua'); insert into insertTest values(101,'zhourunfa'); insert into insertTest values(102,'zhouhuajian');
insert into insertTest select * from insertTest2;
insert into insertTest2(id) select id from insertTest2;
insert into insertTest2 (id,name) select id,name from insertTest where not exists (select * from insertTest2 where insertTest2.id=insertTest.id);
insert into insertTest (id, name) SELECT 100, 'liudehua' FROM dual WHERE not exists (select * from insertTest where insertTest.id = 100);