Subject Re: [firebird-support] Re: Calc field displays blank if 1 field is blank
Author Aage Johansen
ra8009 wrote:

> When I try to use COALESCE it just gives me the last name when both
> the first name and last name exist. If both exist I want both. Is
> there a way to do this with COALESCE?

If you want another way, try UNION

OtToMH:

select cast(LAST_NAME as varchar(100))
from ...
where FIRST_NAME is Null
and LAST_NAME is not Null
union all
select (FIRST_NAME as varchar(100))
from ...
where LAST_NAME is Null
and FIRST_NAME is not Null
union all
select cast ((Last_Name || ', ' || First_Name) as varchar(100))
from ...
where FIRST_NAME is not Null
and LAST_NAME is not Null


I think you'll have to cast to the same size varchar everywhere.


--
Aage J.