X-Original-To: pgsql-php@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 2EBC4924CC5; Tue, 27 May 2003 14:54:38 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 63320-07; Tue, 27 May 2003 14:54:36 -0400 (EDT) Received: from tomts5-srv.bellnexxia.net (tomts5.bellnexxia.net [209.226.175.25]) by developer.postgresql.org (Postfix) with ESMTP id 29AB2924CB2; Tue, 27 May 2003 14:54:36 -0400 (EDT) Received: from [10.0.2.5] ([216.208.117.7]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030527185435.OWQT20954.tomts5-srv.bellnexxia.net@[10.0.2.5]>; Tue, 27 May 2003 14:54:35 -0400 Subject: Re: faster output from php and postgres From: Rod Taylor To: Richard Huxton Cc: Chadwick Rolfs , Frank Bax , pgsql-php@postgresql.org, pgsql-sql@postgresql.org In-Reply-To: <200305271919.05735.dev@archonet.com> References: <200305271919.05735.dev@archonet.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-rZDO1AjUTV8uz8SzqNdS" Organization: Message-Id: <1054061675.93507.40.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 27 May 2003 14:54:36 -0400 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200306/1 X-Sequence-Number: 2065 --=-rZDO1AjUTV8uz8SzqNdS Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2003-05-27 at 14:19, Richard Huxton wrote: > On Tuesday 27 May 2003 5:34 pm, Chadwick Rolfs wrote: > > So, I have the same problem, but I need all authors for each publication > > to show up in it's own column. I tried the full join query from a > > suggestion off pgsql-sql, but it only returns ONE author id TWICE inste= ad > > of ALL authors at once. > > > > I'll do some RTFMing of the joins.. and post any results I get > > > > BUT, right now, looping over each publication with php isn't taking that > > long. I would like to know how to make this query, though! > > > > Please let me know how to get a result like: > > ____________________________________________________ > > > > |All Authors|Title|Source|Year|Type|Length|Keywords| >=20 > Well, if you search the archives for terms "text", "concat", "aggregate" = you=20 > should come up with one solution. This involves writing your own aggregat= e=20 > function, like SUM() but for text. Don't worry, it's not difficult. The o= nly=20 > issue is that you won't be able to guarantee the order of authors in the= =20 > field. If order is required: SELECT custom_aggregate(author) as authors FROM (SELECT author FROM table ORDER BY author) AS tab; The above should give you authors in alphabetical order if custom_aggregate() was written to concatenate text. --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-rZDO1AjUTV8uz8SzqNdS Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA+07Rr6DETLow6vwwRAoN1AJ4hRSmJGcwQDaHREofEY9iJjhZdAACcDpQV 00AMuAv0JwkKfhzBDD7voDY= =h85N -----END PGP SIGNATURE----- --=-rZDO1AjUTV8uz8SzqNdS--