From: | Vibhor Kumar <vibhor(dot)kumar(at)enterprisedb(dot)com> |
---|---|
To: | zab08 <zab08(at)126(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: PostgreSQL group sort |
Date: | 2011-02-25 07:30:06 |
Message-ID: | EC26DF66-EDF4-4A65-9CD5-22C28427B11E@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Feb 25, 2011, at 11:45 AM, zab08 wrote:
> run :
> SELECT b.id, array_accum(s.id), array_accum(s.name)from big b, sm s where b.id = s.big_id group by b.id;
> (ps: array_accum is aggregate in http://www.postgresql.org/docs/9.0/static/xaggr.html)
>
> id | array_accum | array_accum
> ----+-------------+---------------
> 1 | {2,1,3} | {sm1,sm2,sm3}
> 2 | {6,4,4} | {sm4,sm5,sm6}
> (2 rows)
>
> the excepted result:
> id | array_accum | array_accum
> ----+-------------+---------------
> 1 | {1,2,3} | {sm1,sm2,sm3}
> 2 | {4,5,6} | {sm4,sm5,sm6}
Try with intarray Module:
http://www.postgresql.org/docs/8.4/static/intarray.html
Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Cell: +91-932-568-2279
vibhor(dot)kumar(at)enterprisedb(dot)com
Blog:http://vibhork.blogspot.com
From | Date | Subject | |
---|---|---|---|
Next Message | Vasiliy G Tolstov | 2011-02-25 09:21:13 | systemd service |
Previous Message | John R Pierce | 2011-02-25 07:21:15 | Re: Compression hacks? |