Last answered:

09 Nov 2022

Posted on:

10 Nov 2021

2

Why did we use order by in window function over partition by?

Since we want to partition the values by month and sum the 'value' why did we use order by in  window function?
Thankyou

1 answers ( 0 marked as helpful)
Posted on:

09 Nov 2022

1

we use window function lag which requires only sorting (partition is optional for this kind of window functions)
function lag(clmn, n)  just get the nth element before current in the clmn, from table sorted by the column which we defined in window

Submit an answer