I have this ID
column coming as NULL
even though I have put a NOT NULL
expression. It's not any empty string issue or any special character issue because I tried using this expression:
AND COALESCE(SYSTEM_ID,ASSET_NUMBER,SERIAL_NUMBER,'X') <>'X'
In my where clause (same in select) and X
comes in output, why is this happening - I have provided sample select code. I am able to solve it by putting the filter in Having clause or using an outer query
SELECT COALESCE(COL1,COL2,COL3) AS ID,
COL4,
...
COL16
FROM TABLE
WHERE COALESCE(COL1,COL2,COL3) IS NOT NULL
GROUP BY
COL4,
...
COL16