Which version of Postgresql are you using?
However, you may use string_agg like below if its available in your version:
\d t1
Table "public.t1"
Column | Type | Modifiers
--------+---------+-----------
i | integer |
amt | integer |
select * from t1;
i | amt
---+-----
1 | 20
1 | 30
2 | 30
(3 rows)
select i, string_agg(amt::text,',') as c from t1 group by i;;
i | c
---+-------
1 | 20,30
2 | 30
(2 rows)
Have a good day.
On Wed, Jun 19, 2013 at 6:51 AM, Jashaswee <sweet.rinky72@xxxxxxxxx> wrote:
I have numeric values in a numeric column.the column has two parts.i want to
split in 2 differnet column .
The column value looks like this:
Quantity
2000
-1000
both the quantity values are of a same product.but i want these in a single
line.
so what i want is a result set that looks like:
In quantity Out quantity
----------- ------------
2000 -1000
how can i get this in a select statement ?
--
View this message in context: http://postgresql.1045698.n5.nabble.com/postgresql-query-tp5759846.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general