Re: creating view - conditional testing in construct

Поиск
Список
Период
Сортировка
От Casey Allen Shobe
Тема Re: creating view - conditional testing in construct
Дата
Msg-id a6a62ed60910250907g71f4b075w8a481845fa28e515@mail.gmail.com
обсуждение исходный текст
Ответ на Re: creating view - conditional testing in construct  (richard terry <rterry@pacific.net.au>)
Список pgsql-novice
On Sat, Oct 24, 2009 at 5:41 AM, richard terry <rterry@pacific.net.au> wrote:

On Saturday 24 October 2009 09:28:44 richard terry wrote:

I've just implemented nathanial's solution and it solves my problem - thanks -
but I'd still be interested in sampel of using COALESCE.

select coalesce (v.title, '') || ' ' ||
    coalesce (v.firstname, '') || ' ' ||
    coalesce (v.surname, '') || '( ' ||
    coalesce (v.occupation, '') || ') ' ||
    coalesce (v.organisation, '') || ' ' ||
    coalesce (v.branch, '') as summary
from vworganisationsemployees as v;

But probably you want to use case, because with this approach you will still get an extra space padding if something is null.  With case, you can  handle that more elegantly, as already described.

Cheers,
-- 
Casey Allen Shobe

В списке pgsql-novice по дате отправления: