之前我打算将一定的数据插入table1中,
insert into table1(name,age) values('YF','23');
现在想要加入一个条件,就是当table1的name,age分别等于table2中的people和birthDay时,才执行插入操作。

解决方案 »

  1.   

    insert into table1(name,age) 
    select people,birthDay from table2 where people='YF' and birthDay='23'
      

  2.   

    在条件不变的情况下,如果在table1中不止name,age,还要插入其他的colum,如insert into table1(address,name,sex,age) values('111','YF','M','23'),该怎么写呢?条件仍然是插入table1中name,age的值要等于table2中people,birthDay的值时,才能执行插入操作。