SQL Vs SPL: Efficiently Handling Null Values In Database Tables
Sorting HEADER table by UPDATEDDATE, filling ENGX nulls with previous non-null value using SQL window function or esProc SPL's ordered set feature.
We have a database table HEADER, which has data as follows: There is no connection between ENG1, ENG2 and ENG3, and there are null values under them. We can record them as ENGX. We are trying to sort the table by UPDATEDDATE, and, if ENGX in the current record is null, enter ENGX in the previous record in. Below is the desired result table: SQL written in SQL Server: SELECT H.*, MAX(ENG1) OVER (PARTITION BY NAME, GRP1 ) AS IMPUTED_ENG1 , MAX(ENG2) OVER (PARTITION BY NAME, GRP2 ) AS IMPUTED_ENG2 , MAX(ENG3)?OVER (PARTITION BY NAME, GRP3 ) AS IMPUTED_ENG3 FROM ( ...