Return-Path: postman 
Delivery-Date: Fri, 01 Oct 93 14:14:49 PDT
Return-Path: postman
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA25471; Fri, 1 Oct 93 14:08:48 -0700
Resent-From: postman (POSTGRES mailing list)
Resent-Message-Id: <9310012108.AA25471@postgres.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: paxson@postgres.Berkeley.EDU
Received: from elysium.CS.Berkeley.EDU by postgres.Berkeley.EDU (5.61/1.29)
	id AA25458; Fri, 1 Oct 93 14:08:41 -0700
Received: from localhost (paxson@localhost) by elysium.CS.Berkeley.EDU (8.1C/8.1B) id OAA11437; Fri, 1 Oct 1993 14:08:53 -0700
Message-Id: <199310012108.OAA11437@elysium.CS.Berkeley.EDU>
To: Marc Salomon <marc@library.ucsf.edu>
Cc: postgres@postgres.berkeley.edu
Subject: Re: how to get # of instances of a class 
Date: Fri, 01 Oct 1993 14:08:53 -0700
From: "Caroline M. Paxson" <paxson@postgres.Berkeley.EDU>
Resent-To: postgres-dist
Resent-Date: Fri, 01 Oct 93 14:08:46 PDT


You write:

>I would like to get the number of instances of a class, similar to the
>select count(table) structure in INGRES/SQL.

Use the built-in aggregate "count", as follows:

	retrieve (num = count {myclass.attribute1})

Note that you can't specify myclass.all, because this expands to more
than one attribute, which "count" can't handle.

See the "Aggregate Expressions" subsection of the Postgres manual
(the section is called Introduction(Commands)) for more info.


Carol Paxson
Postgres group, U.C. Berkeley
