Subject: how to get # of instances of a class

From: Marc Salomon <[email-masked]>
Date: Fri, 1 Oct 1993 12:07:17 -0700

Hi-

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

Can this be done in postgres?

-marc
//////////////////////////////////////////////////////////////////////////////
\\                                                                          //
// Marc Salomon                                  e-mail: [email-masked]  \\ 
\\ Software Engineer                                                        //
// Innovative Software Systems Group             phone:  415.476.9541       \\
\\ UCSF Center for Knowledge Management                                     //
// 530 Parnassus SF, CA 94134-0840               fax:    415.476.4653       \\
\\                                                                          //
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

---

From: "Caroline M. Paxson" <[email-masked]>
Date: Fri, 01 Oct 1993 14:08:53 -0700

>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