Hello All,
How can I replace Null value of ‘Score’ Column using the last integer value of the same column in the below data.
Here is how my data looks.
|PAT_ID|Score|Recorded Time |Age|
| 1 |NULL|2019:01:15:00:00:00| 16 |
| 1 |NULL|2019:01:15:02:00:00| 16 |
| 1 |17 |2019:01:15:03:00:00| 16 |
| 1 |Null |2019:01:15:04:30:00| 16 |
| 1 |12 |2019:01:15:06:00:00| 16 |
| 1 |null |2019:01:15:08:00:00| 16 |
| 1 |24 |2019:01:15:09:00:01| 16 |
| 1 |null |2019:01:15:10:00:02| 16 |
| 1 |null |2019:01:15:12:00:03| 16 |
| 1 |13 |2019:01:15:14:00:04| 16 |
| 2 |28 |2019:02:01:08:00:05| 43 |
| 2 |28 |2019:02:01:09:00:05| 43 |
| 2 |null |2019:02:01:10:00:05| 43 |
| 2 |null |2019:02:01:11:00:05| 43 |
| 2 |14 |2019:02:01:13:00:05|43 |
| 2 |null |2019:02:01:15:00:05| 43 |
| 2 |19 |2019:02:01:17:00:05| 43 |
I searched in the internet and try everything that's out there but nothing worked. I tried following
cast(substring(Max(cast(PAT_ID as BINARY(15))+ CAST(Scale AS BINARY(12))) OVER (ORDER BY PAT_ID ROWS UNBOUNDED PRECEDING),16,12) AS INT) AS NonNullScore
I try to use first_value, Last_value, Min, MAx with unbounded preceding but I didnot get the expected result. I really appreciate the help.