Re: table linking problem
От
Holger Klawitter
Тема
Re: table linking problem
Дата
Msg-id
200210071651.47143.lists@klawitter.de
Ответ на
table linking problem (¼B¤tºÆ)
Список
Дерево обсуждения
table linking problem "¼B¤tºÆ" <jacky@xtrapower.net>
Re: table linking problem Richard Huxton <dev@archonet.com>
Re: table linking problem Holger Klawitter <lists@klawitter.de>
Re: table linking problem "Shridhar Daithankar" <shridhar_daithankar@persistent.co.in>
> The Question is,
> How can I get like this :
> 100% COTTON
> 63.5% POLYESTER 31.5% NYLON 5% SPANDEX
>
> Can I return the string like this ?
Yes, it can be done with plpgsql.
You need the group operation and create an aggregate like this:
create function str_append( text, text ) returns text as '
begin
if $1 isnull then
return $2;
else
return $1 || '' '' || $2;
end if;
end;' language 'plpgsql';
create aggregate str_concat (
basetype = text,
sfunc = str_append,
stype = text
);
select str_concat( c.percentage || ' ' || m.name )
from content c, material m
where c.material_id = m.material_id
group by c.content_id;
With kind regards / mit freundlichem Gruß
Holger Klawitter
--
Holger Klawitter http://www.klawitter.de
lists@klawitter.de
В списке pgsql-general по дате отправления
От: Shridhar Daithankar
Дата: