Search Postgresql Archives

How to access array element in pgsql after array_agg

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

 




Hello,

I wanna ask how I can access array element in array_agg ?

I do select array_agg(ids) from x;
in ids I have int and result is :

       array_agg
      -------------
    {3843,2,3543,33}

I want to access one element or first one direct in sql query like:

select array_agg(ids)[1] from x;

and to receive int value 2

Any hints how I can do it ?

And also for performance did that is good I to do it in SQL or I should do it in language that I use ? The result in query will return about 2, 3 million rows.


Thank you,

Cheers,
Hristo S.



[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