guys!
So, my team migrated from Oracle to Redhsift and we need to move the logic. Redhsift doesn't have MODEL clause and I have trouble with implementation of this recursive logic into regular sql with windowing functions (LAG). Would you share some hints on how to approach?