向数据库表插入查询的数据

往中间表中插入大量的数据(1万以上),这块表有两个字段,一个字段是确定的,3471;

另外一个字段必须通过查询得到;

 

insert into ec2_customer_resource_ec2_customer_resource_batch(customerresources_id,customerresourcebatches_id)

select b.id,a.id

from ec2_customer_resource_batch a , ec2_customer_resource b

where a.id=3471 and

b.importdate > '2016-12-05 12:20:00' and importdate < '2016-12-05 12:50:00';

 

 

插入一条数据可以直接用模板:

insert into ec2_customer_resource_ec2_customer_resource_batch(customerresources_id,customerresourcebatches_id) values (*, 3071);

 

posted @ 2016-12-05 18:08  ctgu_czy  阅读(884)  评论(0编辑  收藏  举报