> 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