时间:2021-07-01 10:21:17 帮助过:4人阅读
1、累计查询,每天的累计,分指标,分日期
主要关注一下:OVER、PARTITION BY
SELECT
INDEX_DAY,INDEX_PLAN_ID,INDEX_VALUE,SUM(INDEX_VALUE) OVER (PARTITION BY INDEX_PLAN_ID ORDER BY INDEX_DAY) SUM_VALUE
FROM
DW_INDEX_DAY
WHERE
INDEX_PLAN_ID
IN
(‘H03000100‘,‘H03000107‘)
SQL语句
标签:art 查询 over sql index sel select sql语句 日期