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

表复制语句

时间:2019-01-30 01:34:34      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:格式   rom   div   ota   null   int   pre   ice   select   

表复制语句有两种格式

1.Insert into Table2(field1,field2,...) select value1,value2,... from Table1

2.SELECT vale1, value2 into Table2 from Table1

insert into sl_recivable_origin_sub(select null, ro.orgin_recivable_no as origin_no,sov.rock_info_own as origin_sub_info_own
		,SUM(sov.receipt_volume) as origin_sub_volume,null as origin_sub_count_volume,sov.sales_order_price as origin_sub_unit_price
		,SUM(sov.sales_order_total_price) as origin_sub_amount,null as origin_sub_count_amount,null as origin_sub_count_month
		,NOW() as origin_sub_create_time
		 from sl_recivable_origin ro left join sl_sales_order_view sov on ro.orgin_salesorder_no = sov.sales_order_no
		where ro.orgin_recivable_no = #{originNo} group by sov.rock_info_own)

  

表复制语句

标签:格式   rom   div   ota   null   int   pre   ice   select   

原文地址:https://www.cnblogs.com/zhengxq21/p/10336410.html

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