Re: Turning column into row

Поиск
Список
Период
Сортировка
От Tille, Andreas
Тема Re: Turning column into row
Дата
Msg-id Pine.LNX.4.44.0205231119570.8932-100000@wr-linux02.rki.ivbb.bund.de
обсуждение исходный текст
Ответ на Re: Turning column into row  ("Joel Burton" <joel@joelburton.com>)
Ответы Re: Turning column into row  ("Joel Burton" <joel@joelburton.com>)
Список pgsql-sql
On Wed, 22 May 2002, Joel Burton wrote:

> http://www.brasileiro.net/postgres/cookbook/view-one-recipe.adp?recipe_id=13
> 9 will do as a LIST() replacement.
While beeing a great hint it has a syntactical mistake.

The correct syntax would be:

-- creat function to comma-ify a list

create function comma_aggregate(text,text) returns text as '
begin if (length($1) > 0 ) then   return $1 || '', '' || $2;   /* note the '' here !! */ else   return $2; end if;
end;
' language 'plpgsql';


A further question:  Is there any possibility to add a further flag in the
way:
  select fname, lname, comma(hobbies,SPORT_FLAG) from people join hobbies on (personid) group by personid, fname,
lname,SPORT_FLAG;
 

So that we get only those hobbies listed which have SPORT_FLAG = 1
or something else?

Kind regards
       Andreas.


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

Предыдущее
От: Denis
Дата:
Сообщение: Re: Further info : Very high load average but no cpu utilization ?
Следующее
От: rhema@bhasin.co.in
Дата:
Сообщение: ...