'Combine rows ignoring null values
I need to combine the rows which has null values and keep only the unique combination.
Output:
Query: I tried to take the maximum per group but since it considers null value it is not combining. Can you please suggest how to combine values.
SELECT SALES_ORG
,MAX(MATERIAL) OVER (PARTITION BY SALES_ORG,MATERIAL ORDER BY MATERIAL) as MATERIAL
,MAX(MGROUP) OVER (PARTITION BY SALES_ORG,MATERIAL,MGROUP ORDER BY MGROUP ) as MGROUP
,MAX(SERVICE) OVER (PARTITION BY SALES_ORG,MATERIAL,MGROUP,SERVICE ORDER BY SERVICE ) as SERVICE
FROM SALES
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


