首页 > 数据库技术 > 详细

sql备份

时间:2019-02-22 19:00:00      阅读:195      评论:0      收藏:0      [点我收藏+]
SELECT id,Name FROM TeachSite GROUP BY id




select top 1000  1 as [type],SchoolRollID,ChargeableAmount  into #temp from ChargeRecord where bflag=1


select * from #temp  



select 2 as [type], SchoolRollID,SUM(ChargeableAmount) as xj
into #tempxj
 from #temp   group by SchoolRollID

 select 0 as  [typq], null as  SchoolRollID ,SUM(xj) as hj  into #temphj from #tempxj 


 select *  from #temp


insert  into #temp
 select * from #tempxj


insert  into #temp
 select * from #temphj


 select * from #temp order by SchoolRollID,[type] desc 

 

sql备份

原文:https://www.cnblogs.com/chenze-Index/p/10420047.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!