Search Postgresql Archives

Re: multiple column to onec column

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

 



thanks , this is a example of my application.

the ans is here, http://www.postgresql.org/docs/9.0/static/xaggr.html

sql command:

CREATE AGGREGATE array_accum (anyelement)
(
    sfunc = array_append,
    stype = anyarray,
    initcond = '{}'
);

 

SELECT r.role_name, array_accum(permission) from roles r, roles_permissions rp group by r.role_name;


and the result:

role_name |              array_accum              

-----------+---------------------------------------

 role2     | {permission1,permission2,permission1}

 role1     | {permission1,permission2,permission1}




 

 




[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