Subject | Re: [firebird-support] Re: Calc field displays blank if 1 field is blank |
---|---|
Author | Aage Johansen |
Post date | 2004-08-02T21:09:17Z |
ra8009 wrote:
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.
> When I try to use COALESCE it just gives me the last name when bothIf you want another way, try UNION
> the first name and last name exist. If both exist I want both. Is
> there a way to do this with COALESCE?
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.