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.

my table looks this: enter image description here

the result want when completion percentage null should value last non-value completion percentage, this:

enter image description here

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

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -