码迷,mamicode.com
首页 > 其他好文 > 详细

插入查询到的数据

时间:2016-12-05 19:34:54      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:customer   select   and   sources   tom   查询   通过   date   values   

往中间表中插入大量的数据(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);

 

插入查询到的数据

标签:customer   select   and   sources   tom   查询   通过   date   values   

原文地址:http://www.cnblogs.com/chenzeyong/p/6134945.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!