From: | Samuel Gendler <sgendler(at)ideasculptor(dot)com> |
---|---|
To: | Tripura <k_tripura(at)hotmail(dot)com> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Append n Rows into a Single Row |
Date: | 2011-06-18 22:05:58 |
Message-ID: | DF6AD7A8-CD06-422B-BB99-682664F2FCAE@ideasculptor.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Look at the documentation for the tablefunc contrib module. It provides a crosstab() function which will allow you to pivot multiple rows into multiple columns in a single row, with all rows that share a particular key in one or more columns pivoting up into the same row, but different keys ending up as separate rows. You could then string concatenate all columns of a single row into a single string if desired,
Sent from my iPhone
On Jun 17, 2011, at 17:20, Tripura <k_tripura(at)hotmail(dot)com> wrote:
> Hi,
> I am totally new to PostgreSQL and this is my first script.
> Can anyone please help me with my following requirement
>
> I have script that returns 1 column and 40 rows.
> My requirement is update this existing script to show all the 40 rows data
> in a single row as a string.
>
> For example
> The current script returns, something like this
> Tom
> Tad
> Max
> Ted
>
> I have to update the existing script to show the above results as follow
> Tom || Tad || Max || Ted
>
> Something like colace in Ms sql
>
> Any help is really appriciated.
>
> Thankyou in Advance.
>
>
>
>
>
>
>
> --
> View this message in context: http://postgresql.1045698.n5.nabble.com/Append-n-Rows-into-a-Single-Row-tp4500306p4500306.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
From | Date | Subject | |
---|---|---|---|
Next Message | Rob Sargent | 2011-06-19 03:33:54 | Re: Append n Rows into a Single Row |
Previous Message | Tripura | 2011-06-18 00:20:23 | Append n Rows into a Single Row |