SQL problem with aggregate functions.

From: David BOURIAUD <david(dot)bouriaud(at)ac-rouen(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: SQL problem with aggregate functions.
Date: 2002-07-09 08:36:17
Message-ID: 200207091036.17913.david.bouriaud@ac-rouen.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi the list !
I've got a table in which there is a field that can have one amongst 3
possible values : D, R, X. Is it possible to get in one query the count of
this different values.Please, note that I don't want to have a querry like
this :
"select count (*) from tab group by f1;", cause i want to get all the possible
count values in one row (these data are already grouped on another field).
To give a more accurate example, here is what I want to retrieve :

Field group | count of D | count of R | count of X.

Any clues ?
--
David BOURIAUD
----------------------------------------------------------
In a world without walls or fences, what use do we have
for windows or gates ?
----------------------------------------------------------
ICQ#102562021

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2002-07-09 12:18:36 Re: INSERT only under certain conditions (SELECT)
Previous Message JGM 2002-07-09 07:04:40 Waiting for Update