查询2018年agmt_id=1076226890174464676612的,且金额类型代码为0212,每日协议金额。
1.协议金额历史表取某一日数据(20180101)
sel t.start_dt ,agmt_amt from pdm_view.v03_agmt_amt_h t --协议金额历史 and t.start_dt<='20180101' and t.end_dt>'20180101' where t.agmt_id='1076226890174464676612' and t.amt_typ_cd='0212'
2.协议金额历史表取某一段日期数据(20180101-20180105)
sel t.start_dt ,agmt_amt from pdm_view.v03_agmt_amt_h t --协议金额历史 and t.start_dt<='20180105' and t.end_dt>'20180101' where t.agmt_id='1076226890174464676612' and t.amt_typ_cd='0212'
3.借助日历表取2018年每一日的数据协议金额
sel c.calendar_date ,t.start_dt ,agmt_amt from pdm_view.v03_agmt_amt_h t --协议金额历史 inner join sys_calendar.calendar c on c.year_of_calendar='2018' and t.start_dt<=c.calendar_date and t.end_dt>c.calendar_date where t.agmt_id='1076226890174464676612' and t.amt_typ_cd='0212'