I know this is a “not build in” or “the way dba thinks” but a programmer approach, how could one request from 3 fields to get the one that is not null, into a result field.
Let’s say we have a table with f1,f2,f3,f4,f5.
Let’s say f2,f3,f4 are the same type.
Let’s say the content of the table be tuples of
(key1,null,null,value1,value2)
(key2,null,value3,value4,value5)
(key3,null,null,null,value6)
Now if we return the first tuple then we get (key1) we get (key1,value1,value2)
If we ask for key2 we get (key1,value3,value5)
If we ask for key3 we get (key1,null,value6)
How is it possible to get the fields in the priority of if you have value in f2, then its set into the returned field, only then if we have value in f3 then its set into the middle returned field, only then if we have value in f4 then its set into the middle returned field
The main goal is to get the result into a single field and prevent the overhead work needed at the result end.
As Bernd_k suggested, COALESCE is your friend here