I have a sql something like so
sum(table1.col1) over(PARTITION BY table1.col2, table1.col3
order by table1.col4 rows unbounded preceding) as runningqty,
(table2.col1)+(sum(table1.col1) over(PARTITION BY table1.col2, table1.col3
order by table1.col4 rows unbounded preceding)) as netqty,
ROW_Number () OVER(PARTITION BY table1.col1, table1.col2 ORDER BY table1.col4 ASC) as Rank
from table
join....