Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA21816; Wed, 10 Mar 93 15:15:35 -0800
Date: Wed, 10 Mar 93 15:15:35 -0800
Message-Id: <9303102315.AA21816@postgres.Berkeley.EDU>
From: carlf@ai.mit.edu (Carl Feynman)
Subject: Aggregating subsets
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu


Here's a possibly dumb question from a beginning postgres user.  I
create a class ELT with two integer and one float attribute:

	create ELT (i=int4, j=int4, r=float4) \g

Then I define an aggregate float4ave, which I can use to find the mean
of the float4 attribute:

	retrieve (ave =  float4ave {ELT.r}) \g

This works fine.  However, what I really want is a table of the
average value of r for each different value of i.  I try this:

	retrieve (i= e.i, ave= float4ave {ELT.r where ELT.i = e.i}) 
		from e in ELT \g

and it doesn't work.  How can I do this?

--carlf
