标题1
INSERT INTO T_CDSC_OWE_01
(ASSET_ROW_ID, CDSC_ID, CDSC_NAME, CDSC_EFF_DT, CDSC_EXP_DT, CDSC_DUR)
SELECT ASSET_ROW_ID, CDSC_ID, CDSC_NAME, CDSC_EFF_DT, CDSC_EXP_DT,
CDSC_DUR
FROM (SELECT A.ASSET_ROW_ID, A.CDSC_ID, A.CDSC_NAME, A.CDSC_EFF_DT,
A.CDSC_EXP_DT, B.CDSC_DUR,
ROW_NUMBER() OVER(PARTITION BY A.ASSET_ROW_ID ORDER BY A.CDSC_EFF_DT DESC) RNUM
FROM SXMART.OFR_ASSET_CDSC_MON_E A
INNER JOIN SXMART.OFR_CDSC_E B
ON A.CDSC_ID = B.CDSC_ID
WHERE A.BIL_MONTH = '201406'
AND B.CDSC_OBJ_NAME = '多产品优惠'
AND B.CDSC_NAME LIKE '%e9%'
AND SUBSTR(B.CDSC_ID, 1, 2) IN ('75', '90')
AND B.CDSC_NAME NOT LIKE '%虚拟网%'
AND A.STAT_NAME <> '失效')
WHERE RNUM = 1;
标题 | 标题 | 标题 |
---|---|---|
1 | 2 | 3 |
引用
这一段可以这么用
网友评论