In SQL server, I often see this referred to as a "smear" and there's blog posts about using a "quirky update" to do it. But how would I do it with windowing functions. For example, if I have:
name date happiness
---- ---- ---------
John 1/3 20
John 1/4 NULL
John 1/5 NULL
John 1/6 NULL
John 1/7 18
Mary 1/2 35
Mary 1/3 NULL
Mary 1/4 -15
Mary 1/6 NULL
Mary 1/7 0
Is there a way to do something like:
SELECT
[name],
[date],
CARRY([happiness]) OVER (PARTITION BY [name] ORDER BY [date])
So that the intermediate results look like:
name date happiness
---- ---- ---------
John 1/3 20
John 1/4 20
John 1/5 20
John 1/6 20
John 1/7 18
Mary 1/2 35
Mary 1/3 35
Mary 1/4 -15
Mary 1/6 -15
Mary 1/7 0
CARRY
isn't a real function clearly, just want that functionality.