I'm exactly doing the same thing as here Date Difference between consecutive rows
However I want the result to show me avg of difference in days per every account_number and not one row for every difference in days.
Something like this.
When I add avg(datediff(d1,d2)), i'm getting the following error:
[Code: -112, SQL State: 42607] The operand of the column function "AVG" includes a column function, a scalar fullselect, or a subquery.. SQLCODE=-112, SQLSTATE=42607, DRIVER=4.22.29
PS:
- I was unable to add comment on the same page of the above link as my stack overflow score is low & it doesn't allow me to comment.
- I'm using db2 so instead of datediff I use timestampdiff. Dint want to confuse by writing it above.
- Apologies if its not clear. Do let me know what can I do better