X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6617F4753A1 for ; Sat, 1 Mar 2003 12:08:54 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 15289-08 for ; Sat, 1 Mar 2003 12:08:52 -0500 (EST) Received: from jester.inquent.com (CPE00508b028d7d-CM00803785c5e0.cpe.net.cable.rogers.com [24.103.51.175]) by postgresql.org (Postfix) with ESMTP id 628B6474E61 for ; Sat, 1 Mar 2003 12:08:52 -0500 (EST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by jester.inquent.com (8.12.6/8.12.6) with ESMTP id h21H76vD028568; Sat, 1 Mar 2003 12:07:07 -0500 (EST) (envelope-from rbt@rbt.ca) Subject: Re: Denormalizing during select From: Rod Taylor To: Edmund Lian Cc: pgsql-sql@postgresql.org In-Reply-To: References: <200302241433.49502.josh@agliodbs.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-zw2IM96l1Yf7qXUwiibh" Organization: Message-Id: <1046538423.26763.178.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 01 Mar 2003 12:07:06 -0500 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/13 X-Sequence-Number: 12053 --=-zw2IM96l1Yf7qXUwiibh Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2003-02-25 at 13:48, Edmund Lian wrote: > On Tue, 25 Feb 2003 03:44:02 GMT, Edmund Lian wrote: >=20 > >I found this example in "Practical PostgreSQL"... will it do the job? >=20 > Answering my own question: kind of. The problem with custom aggregates > is that they need to be used with a "group by" clause, and this means > that the select cannot return columns that are not aggregates of some > kind. What I'm trying to return are rows that are a combination of > columns and aggregates. I've been trying to figure out how to give a running total (similar issue I think). key value 1 5 1 5 1 5 2 1 2 2 2 1 Query output: key value sum to point 1 5 5 1 5 10 1 5 15 2 1 1 2 2 3 2 1 4 I think I should be able to do it with an aggregate -- but the best I've been able to come up with is a Set Returning Function. --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-zw2IM96l1Yf7qXUwiibh Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQA+YOi36DETLow6vwwRAg07AJ0eOsI7scZexZD8AiUZDoFmwhU9RQCfUR5z PpREXBrXfR999Nk9j0/YttY= =UWdd -----END PGP SIGNATURE----- --=-zw2IM96l1Yf7qXUwiibh--