91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

連續逾期

發布時間:2020-03-14 19:38:04 來源:網絡 閱讀:262 作者:Kassadar 欄目:關系型數據庫

IF EXISTS(SELECT FROM SYS.TABLES WHERE NAME='SPD') DROP TABLE SPD;
WITH CTE1 AS
(
SELECT
IIF(PD_DueDT>=ISNULL(PD_DebitSuccDT,'9999-12-31'),0,1) AS FLAG/
逾期FLAG/,
ROW_NUMBER() OVER(PARTITION BY PD_EFH_SN ORDER BY PD_Termth) AS ID/
期次序號/,
MAX(PD_Termth) OVER (PARTITION BY PD_EFH_SN)AS CurrID/
當前最大期次序號*/,

  • FROM PD WHERE PD_DueDT<=GETDATE() AND PD_Termth>0
    ),
    CTE2 AS
    (
    SELECT
    SUM(FLAG) OVER(PARTITION BY PD_EFH_SN ORDER BY PD_Termth ROWS UNBOUNDED PRECEDING) AS AccuFlag/累計逾期期次/,

  • FROM CTE1
    ),
    CTE3 AS
    (
    SELECT
    ID-AccuFlag AS FlagGrp/逾期分組/,

  • FROM CTE2
    ),
    CTE4 AS
    (
    SELECT
    SUM(FLAG) OVER (PARTITION BY PD_EFH_SN,FlagGrp) AS CountFlag/分組計數/,

  • FROM CTE3 WHERE FLAG=1
    ),
    CTE5 AS
    (
    SELECT
    MAX(CountFlag) OVER (PARTITION BY PD_EFH_SN) AS MaxContFlag/最大連續/,
    MAX(AccuFlag) OVER (PARTITION BY PD_EFH_SN) AS TotFlag/歷史累計/,
    IIF(ID=PD_TotTerm,CountFlag,0) AS CurrContFlag/當前累計/,
    ROW_NUMBER() OVER (PARTITION BY PD_EFH_SN ORDER BY PD_Termth DESC) AS CurrTermth,

  • FROM CTE4
    )
    SELECT DISTINCT PD_EFH_SN,MaxContFlag,TotFlag,CurrContFlag,'XFY' AS DataSource INTO SPD FROM CTE5 WHERE CurrTermth=1

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

和田县| 美姑县| 崇明县| 库尔勒市| 五原县| 晋州市| 迁安市| 曲麻莱县| 玉门市| 宽甸| 洛阳市| 河曲县| 昭苏县| 金门县| SHOW| 天长市| 新绛县| 瑞昌市| 英吉沙县| 阿鲁科尔沁旗| 永顺县| 尼勒克县| 凉城县| 桦南县| 连州市| 永福县| 甘洛县| 凤凰县| 封丘县| 汝阳县| 依兰县| 唐海县| 祥云县| 舞钢市| 忻州市| 边坝县| 汕头市| 宁海县| 宾川县| 东乡县| 壤塘县|