[SQL] Returning array of IDs as a sub-query with group-by

2007-08-25 Thread Andreas Joseph Krogh
Hi all. I have the following schema: create table item( id serial primary key ); create table item_log( id serial primary key, item_id integer not null references item(id), price numeric NOT NULL ); insert into item(id) values(1); insert into item(id) values(2); insert into item(id) values(3);

Re: [SQL] Returning array of IDs as a sub-query with group-by

2007-08-25 Thread Andreas Joseph Krogh
On Saturday 25 August 2007 17:10:57 Andreas Joseph Krogh wrote: > Hi all. > I have the following schema: > > create table item( > id serial primary key > ); > > > create table item_log( > id serial primary key, > item_id integer not null references item(id), > price numeric NOT NULL > ); > > > inse

Re: [SQL] Returning array of IDs as a sub-query with group-by

2007-08-25 Thread Ragnar
On lau, 2007-08-25 at 17:55 +0200, Andreas Joseph Krogh wrote: > On Saturday 25 August 2007 17:10:57 Andreas Joseph Krogh wrote: [snip] > > count | item_id | price | item_id_array > > ---+-+---+--- > > 3 | 1 | 100 | {1,2,3} > > 6 | 1 | 200 |

Re: [SQL] Returning array of IDs as a sub-query with group-by

2007-08-25 Thread Andreas Joseph Krogh
On Saturday 25 August 2007 23:02:19 Ragnar wrote: > On lau, 2007-08-25 at 17:55 +0200, Andreas Joseph Krogh wrote: > > On Saturday 25 August 2007 17:10:57 Andreas Joseph Krogh wrote: > > [snip] > > > > count | item_id | price | item_id_array > > > ---+-+---+--- > > >