Here is my dummy Schema in MYSQL:
A column: which is a nullable string
B column: which is a string but its not null
I only want to select A columns but when facing a null, I want it to be replaced with the B column.
How can I do that?
this is my desired output
Advertisement
Answer
Use coalesce()
:
select coalesce(a, b) as a from t;