From: | Roberto Mello <rmello(at)cc(dot)usu(dot)edu> |
---|---|
To: | Elizabeth O'Neill's Office Mail <elizabeth(dot)oneill(at)abcmail(dot)co(dot)uk> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: SQL syntax for concating values in different rows together |
Date: | 2002-12-10 16:10:46 |
Message-ID: | 20021210161046.GI14110@cc.usu.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, Dec 10, 2002 at 12:27:34PM +0000, Elizabeth O'Neill's Office Mail wrote:
> Hi
>
> Can someone please help me.
>
> I have two tables in my database a complaint table and a resolution table.
> One complaint may have several resolutions. I am trying to build a report
> that will give me the complaint details and all the resolution descriptions
> for a complaint in one text area/row (concated together).
>
> At the moment it is repeating the complaint details for each resolution.
You could create a PL/pgSQL function that would take the id of the
resolution to query the complaints table and return the concatenation of
all the details.
That way you could just:
SELECT
id, foo, bar, concat_resolution_details(id)
FROM
resolutions;
I'd give it a shot at the function, but you didn't give the structure of
the table.
-Roberto
--
+----| Roberto Mello - http://www.brasileiro.net/ |------+
+ Computer Science Graduate Student, Utah State University +
+ USU Free Software & GNU/Linux Club - http://fslc.usu.edu/ +
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2002-12-10 18:31:41 | Re: SQL syntax for concating values in different rows together |
Previous Message | Elizabeth O'Neill's Office Mail | 2002-12-10 12:27:34 | SQL syntax for concating values in different rows together |