根据INVT_PROD_ID和START_DT,按照ANN_DT 进行排序:
select count(*) OVER(PARTITION BY A.INVT_PROD_ID, A.START_DT ORDER BY A.ANN_DT desc) as num,
A.INVT_PROD_ID,
A.START_DT,
A.SCALE
from T_H_PD_INVT_PROD_SCL A
select count(*) OVER(PARTITION BY A.INVT_PROD_ID, A.START_DT ORDER BY A.ANN_DT desc) as num,
A.INVT_PROD_ID,
A.START_DT,
A.SCALE
from T_H_PD_INVT_PROD_SCL A