sql insert into select语句写法-将查询结果直接插入到表中

 

 

insert into month_gpcj_info(idStr,zszrmygpsl,xyzrmygpsl,mycje,mycjl,month_date,dataCompiledDate) select UUID() idstr,
max(m.GPGSZSZhuanRangShu) zszrmygpsl,max(m.GPGSXYZhuanRangShu) xyzrmygpsl,
sum(m.CJHeJiJinE) mycje,sum(m.RJCJGPHeJi) mycjl ,'201501' month_date,'2015-09-01' dataCompiledDate 
from market_scope_statistics m  
where m.dataCompiledDate like '2015-01-%';

 

转载于:https://www.cnblogs.com/hwaggLee/p/4775778.html

你可能感兴趣的:(sql insert into select语句写法-将查询结果直接插入到表中)