Re: [GENERAL] update and group by/aggregate

2008-08-27 Thread Sam Mason
Oops, both my statements were horribly broken. They needed a WHERE clause for the UPDATE. On Wed, Aug 27, 2008 at 11:44:20AM +0100, Sam Mason wrote: > UPDATE catalog_items SET authors=array_to_string(x.authors,', ') > FROM ( > SELECT ia.itemid, array_accum(trim(' \t]' from a.name)) AS autho

Re: [GENERAL] update and group by/aggregate

2008-08-27 Thread Sam Mason
On Wed, Aug 27, 2008 at 10:32:43AM +0200, Ivan Sergio Borgonovo wrote: > How can I update catalog_items.Authors > > create table catalog_items( > ItemID bigint primary key, > Authors varchar(1024) > ); The type "varchar(1024)" looks a little awkward, wouldn't an unadorned TEXT be easier? if y

Re: [GENERAL] update and group by/aggregate

2008-08-27 Thread Pavel Stehule
2008/8/27 Ivan Sergio Borgonovo <[EMAIL PROTECTED]>: > How can I update catalog_items.Authors > > create table catalog_items( > ItemID bigint primary key, > Authors varchar(1024) > ); > > taking results from > > select ia.ItemID, array_accum(trim(' \t]' from a.Name)) > from catalog_itemauthor ia

[GENERAL] update and group by/aggregate

2008-08-27 Thread Ivan Sergio Borgonovo
How can I update catalog_items.Authors create table catalog_items( ItemID bigint primary key, Authors varchar(1024) ); taking results from select ia.ItemID, array_accum(trim(' \t]' from a.Name)) from catalog_itemauthor ia join catalog_author a on a.AuthorID=ia.AuthorID where a.Name is