oracle:
(Select to_char(a+1-Id,'YYYYMMDD') SHOW_TIME From (
SELECT rownum Id,to_date( #{endDate,jdbcType=VARCHAR} ,'YYYYMMDD') a FROM DUAL
CONNECT BY LEVEL <= to_date(#{endDate,jdbcType=VARCHAR},'YYYYMMDD') - to_date(#{startDate,jdbcType=VARCHAR},'YYYYMMDD') +1) Order By SHOW_TIME) d LEFT JOIN tableA
DB2:
--取指定区间的自然天
with date_list(SHOW_TIME) as
(select to_date(#{startDate,jdbcType=VARCHAR},'YYYYMMDD')
from test.tableA a where a.USER_ID=#{userId,jdbcType=VARCHAR}
union all
select date_list.SHOW_TIME+1 day
from test.tableA b ,date_list where b.USER_ID=#{userId,jdbcType=VARCHAR} and date_list.SHOW_TIME <= to_date( #{endDate,jdbcType=VARCHAR} ,'YYYYMMDD')),
--统计交易
trans_list(transDate,txnCount,txnAmt) as
(select .......)
--外连接获取交易统计数据
select * from date_list d LEFT JOIN trans_list e
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。