Sql case that will use a current table
- by Dana Ezer
I have an sql statement that returns this result below,and I want that the num will drag the latest(by date) num that is not null. I can't get it right.
I want to add somthing like this:
case
when num is null then max(num where date<my_date)
my result now:
Date num
1.1 0
2.1 1
3.1 NULL
4.1 NULL
5.1 4
what I want:
Date num
1.1 0
2.1 1
3.1 1
4.1 1
5.1 4