Re: SQL syntax for concating values in different rows together
От | Roberto Mello |
---|---|
Тема | Re: SQL syntax for concating values in different rows together |
Дата | |
Msg-id | 20021210161046.GI14110@cc.usu.edu обсуждение исходный текст |
Ответ на | SQL syntax for concating values in different rows together ("Elizabeth O'Neill's Office Mail" <elizabeth.oneill@abcmail.co.uk>) |
Список | 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/ +
В списке pgsql-sql по дате отправления: