Merlin Moncure wrote:

-----Original Message-----
From: mlw [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 3:47 PM
To: [EMAIL PROTECTED]
Subject: [HACKERS] Aggregate "rollup"

I had written a piece of code about two years ago that used the
aggregate feature of PostgreSQL to create an array of integers from an
aggregate, as:

select int_array_aggregate( column ) from table group by column




Do I understand correctly that this still follows the normal rules for grouping, so that only like values are put in the array?

Example: column has values 1,1,1,2,2 spread over 5 rows.
Your query returns two rows with row1={1,1,1} and row2 = {2,2}...is this
correct?

Actually, it is more intended to put all the entries in a "one to many" table in a single column, as:

create table classic_one_to_many
(
   leftside    integer,
   rightside    integer
);

create table fast_lookup as select leftside, int_array_aggregate(rightside) from classic_one_to_many group by leftside;



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to