X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8969B476182 for ; Wed, 7 May 2003 05:00:08 -0400 (EDT) Received: from ebene.inrialpes.fr (ebene.inrialpes.fr [194.199.18.70]) by postgresql.org (Postfix) with ESMTP id 7C0C3475AE5 for ; Wed, 7 May 2003 05:00:06 -0400 (EDT) Received: from imap-serv.inrialpes.fr (imap-serv.inrialpes.fr [194.199.18.72]) by ebene.inrialpes.fr (8.11.6/8.11.6) with ESMTP id h47905D25392; Wed, 7 May 2003 11:00:05 +0200 (MEST) Received: from there (chomolhari.inrialpes.fr [194.199.22.164]) by imap-serv.inrialpes.fr (8.11.6/8.11.3/ImagV2) with SMTP id h47906k21567; Wed, 7 May 2003 11:00:06 +0200 (MEST) Message-Id: <200305070900.h47906k21567@imap-serv.inrialpes.fr> Content-Type: text/plain; charset="iso-8859-1" From: DIB Walid Organization: INRIA To: wahab@mimos.my Subject: Re: SQl query Date: Wed, 7 May 2003 11:00:04 +0200 X-Mailer: KMail [version 1.3.1] References: <3EB8C1C5.4745E77E@mimos.my> In-Reply-To: <3EB8C1C5.4745E77E@mimos.my> Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-26.0 required=5.0 tests=BAYES_01,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/116 X-Sequence-Number: 13281 Hello, here is a suggestio: select transporttype, count(transportid) as number of transport from transport group by transporttype; @+ Walid Le Mercredi 7 Mai 2003 10:20, vous avez =E9crit : > If I've a transport table like this: > transporttype | transportid > ---------------+------------- > Lorry | 1037 > Pickup | 1038 > Lorry | 1040 > Lorry | 1045 > Pickup | 1046 > Lorry | 1047 > > How do I make a query so that I get a result like > > transporttype | #of transport > ---------------+------------- > Lorry | 4 > Pickup | 2 > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)