窗口函数累加递增
select a.OrderNum,a.num,a.CreateTime,b.audittime, sum(a.num) over(order by a.OrderNum range between unbounded preceding AND CURRENT ROW) as currenttotal from table1 a inner join table2 b on a.OrderNum=b.OrderNum where ItemNum='111111' and b.IsDelete=0 and b.Status=1 and a.StorageNum='1'
partition by在over里面实现group by的功能
select itemnum,count(itemnum) over(partition by itemnum) as cnt from table1