Subject | Re: Calc field displays blank if 1 field is blank |
---|---|
Author | ra8009 |
Post date | 2004-08-02T19:41:24Z |
In my select statement I want to concatenate first and last name if
they both are not null. If one of them is null, I want to use just the
not null value. How can I accomplish this?
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@u...> wrote:
they both are not null. If one of them is null, I want to use just the
not null value. How can I accomplish this?
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@u...> wrote:
> Hi,MS SQL
>
>
> > This SQL produces a blank if the first or last name is blank:
> >
> > ((Last_Name||', ')||First_Name)
> >
> > How can I write it so it will display just the last name or first name
> > if the other name is blank?
>
> I assume you mean "if the other name is NULL", right?
>
> There's an easy workaround by using COALESCE.
>
> The question is, however: why are you storing NULL?
> Do you want to store NULL or an empty string?
>
> With regards,
>
> Martijn Tonies
> Database Workbench - developer tool for InterBase, Firebird, MySQL &
> Server.
> Upscene Productions
> http://www.upscene.com