SQL 计算累计和 sum() over( partition by order by )
0.数据
1. sum(LABST) over()
2. sum(LABST) over(order by MATNR)
3.sum(LABST) over(order by MATNR,ZWEEK)
4.sum(LABST) over(partition by MATNR order by MATNR)
5.sum(LABST) over(partition by MATNR order by MATNR,ZWEEK)
以上。实践完毕
HAVING
SQL 找到数据集中的重复数据
matnr 在表zmmmara中是否存在重复数据
SELECT MATNR ,COUNT(1) FROM ZMMMARA
GROUP BY MATNR
HAVING COUNT(1) > 1