consider a table named "TABLE-A" with below data.
ID hcc D_CD
1 null 1
1 5 1
2 null 2
2 10 2
2 20 3
3 null 3
I need to select ID,hcc fields from TABLE-A in the combination of ID,D_CD. when the combination has single hcc value (even it is null) it should be fetched. But, when it has both null and not null values, it should fetch the not null value only. So the output must be as below.
OUTPUT:
ID hcc
1 5
2 10
2 20
3 null
can anyone please help me on this? thanks in advance.