sql - How to get the last not null value from previous rows -
i know there lot of solutions unfortunately cannot use partition or keyword top. nothing tried on earlier posts works.
the result want when completion percentage null should value last non-value completion percentage, this:
this done using outer apply
:
select t.projectname, t.sequence, coalesce(t.completion_percentage, t2.completion_percentage) completion_percentage t outer apply (select top 1 t2.* t t2 t2.projectname = t.projectname , t2.completion_percentage null , t2.sequence < t.sequence order t2.sequence desc ) t2;
Comments
Post a Comment