From: | Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com> |
---|---|
To: | Andre Lopes <lopes80andre(at)gmail(dot)com> |
Cc: | postgresql Forums <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Select rotate in PostgreSql |
Date: | 2013-03-13 13:38:51 |
Message-ID: | CAFcNs+roa4AjOuB71yh+GZaDFxqmPw8NkNSdmQVZ6u7gUDoVmg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Mar 13, 2013 at 10:32 AM, Andre Lopes <lopes80andre(at)gmail(dot)com>wrote:
> Hi all,
>
> I don't know how to ask for this. I need to rotate a Select in
> PostgreSql, just like this: http://dpaste.com/1021691/
>
> I can achieve this easily without a procedure?
>
>
Hi Andre,
If I understood you want to aggregate "comments" into a single line... is
it? If yes then you can try this:
SELECT article_id, string_agg(comments, ' ') FROM your_table GROUP BY
article_id;
Best regards,
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
From | Date | Subject | |
---|---|---|---|
Next Message | Thor Michael Støre | 2013-03-13 14:18:03 | SELECT 1 = ANY (SELECT ARRAY[1, 2, 3]) -> ERROR: operator does not exist: integer = integer[] ? |
Previous Message | Merlin Moncure | 2013-03-13 13:38:20 | Re: Select rotate in PostgreSql |