Search Postgresql Archives

Re: PostgreSQL group sort

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.kumar@xxxxxxxxxxxxxxxx
Blog:http://vibhork.blogspot.com


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux