• 【Teradata SQL】日历函数查询


    查询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'
  • 相关阅读:
    1154 Vertex Coloring (25 分)
    7-4 Replacement Selection (30 分)
    7-3 Safari Park (25 分)
    7-2 The Judger (25 分)
    7-1 Prime Day (20 分)
    1101 Quick Sort (25 分)
    1093 Count PAT's (25 分)
    1128 N Queens Puzzle (20 分)
    N皇后问题
    1038 Recover the Smallest Number (30 分)
  • 原文地址:https://www.cnblogs.com/badboy200800/p/10770292.html
Copyright © 2020-2023  润新知