> > Ah well, SQL (these days) provides plenty of functions to avoid
> > the problems. Coalesce being one of them...
> >
> > How often do people write:
> >
> > (probably not valid MySQL)
> > select firstname || coalesce(middlename || ' ', ' ') || lastname
> > from ...
> >
> Your syntax isn't quite correct; coalesce doesn't use a concatenation 
> symbol, it uses a list of arguments like this:
>
>     coalesce(Salary, commission, bonus)

Yes, the reason I was using || ' ' there was when middle
name was not null, it would already add a space, and
when it's null, it would just return a space.
Given that NULL || ' ' returns NULL anyways, this would
be give me the results for all cases, I think :)

--
Martijn Tonies


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to