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)
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