首页 > 编程语言 > 详细

按日期导出拉链算法的历史值

时间:2015-05-07 20:07:42      阅读:274      评论:0      收藏:0      [点我收藏+]

select
sum( case when (t.beg_dt<=‘20150401‘ and t.end_dt>‘20150401‘) then t.ac_bal else 0 end ) d1,
sum( case when (t.beg_dt<=‘20150402‘ and t.end_dt>‘20150402‘) then t.ac_bal else 0 end ) d2,
sum( case when (t.beg_dt<=‘20150403‘ and t.end_dt>‘20150403‘) then t.ac_bal else 0 end ) d3
from FNTACCBALHIS t where t.bal_typ=0 and chk_typ=‘1‘ and t.end_dt>‘20150401‘ and t.beg_dt<=‘20150403‘
group by t.inn_ac_no

按日期导出拉链算法的历史值

原文:http://www.cnblogs.com/dashi/p/4485770.html

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