码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2015-05-07 20:09:51      阅读:147      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!