X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E0A804764B4 for ; Wed, 7 May 2003 04:55:32 -0400 (EDT) Received: from shield.nordlb.lv (shield.pirmabanka.lv [195.114.57.4]) by postgresql.org (Postfix) with ESMTP id 5552747640D for ; Wed, 7 May 2003 04:55:31 -0400 (EDT) Received: from wall2.pirmabanka.lv (wall2-pub.nordlb.lv [195.114.57.14]) by shield.nordlb.lv (8.12.9/8.12.9) with SMTP id h478tLbg007708 for ; Wed, 7 May 2003 11:55:21 +0300 Received: from share.nordlb.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Wed, 07 May 2003 11:55:20 +0300 (EET DST) Received: from pc311x1.nordlb.lv (localhost.localdomain [127.0.0.1]) by nordlb.lv (8.11.6/8.11.6) with SMTP id h478tKc25004 for ; Wed, 7 May 2003 11:55:20 +0300 Received: (qmail 19355 invoked by uid 100); 7 May 2003 08:57:28 -0000 Date: Wed, 7 May 2003 11:57:28 +0300 From: "Victor Yegorov" To: Abdul Wahab Dahalan Cc: pgsql-sql@postgresql.org Subject: Re: SQl query Message-ID: <20030507085728.GQ17892@nordlb.lv> Mail-Followup-To: Abdul Wahab Dahalan , pgsql-sql@postgresql.org References: <3EB8C1C5.4745E77E@mimos.my> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+gHRqQ1BTyNna/y8" Content-Disposition: inline In-Reply-To: <3EB8C1C5.4745E77E@mimos.my> User-Agent: Mutt/1.4.1i X-Spam-Status: No, hits=-28.1 required=5.0 tests=BAYES_10,IN_REP_TO,PGP_SIGNATURE_2,REFERENCES, USER_AGENT_MUTT 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/115 X-Sequence-Number: 13280 --+gHRqQ1BTyNna/y8 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Abdul Wahab Dahalan [07.05.2003 11:52]: > If I've a transport table like this: > transporttype | transportid > ---------------+------------- > Lorry | 1037 > Pickup | 1038 > Lorry | 1040 > Lorry | 1045 > Pickup | 1046 > Lorry | 1047 >=20 > How do I make a query so that I get a result like >=20 > transporttype | #of transport > ---------------+------------- > Lorry | 4 > Pickup | 2 select transporttype, count(transporttype) from your_table group by transporttype; --=20 Victor Yegorov --+gHRqQ1BTyNna/y8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE+uMp42RKGLEykUDYRAjGgAJ9QZ/ICtEvswzc++QPHh8AsV6hy0QCfetId mQtwagRtFDwzgjEPo0IVE3Y= =Z+z2 -----END PGP SIGNATURE----- --+gHRqQ1BTyNna/y8--