I have the following query:
Select
impressions,
COALESCE(u.company,u.email) AS Publisher
FROM users AS u
Here, the company field has a company name or a Null or a Blank value. I don't want Publisher column to have a blank or a null value.
The above statement works for NULL as it returns the u.email value in that case. But it does not work for blank values. So I tried doing:
COALESCE(NULLIF(u.company,''),u.email)
This does not seem to work as blank values are not replaced by email.
Can somebody please point out where I am going wrong? Is there an alternative?
u.company?