X-Original-To: pgsql-sql@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 36DC89251CC for ; Tue, 20 May 2003 21:14:34 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 19393-02 for ; Tue, 20 May 2003 21:14:31 -0400 (EDT) Received: from tomts9-srv.bellnexxia.net (tomts9.bellnexxia.net [209.226.175.53]) by developer.postgresql.org (Postfix) with ESMTP id 88E759251C2 for ; Tue, 20 May 2003 21:14:30 -0400 (EDT) Received: from [192.168.1.200] ([64.231.213.3]) by tomts9-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030521011430.SJH20530.tomts9-srv.bellnexxia.net@[192.168.1.200]>; Tue, 20 May 2003 21:14:30 -0400 Subject: Re: selecting entire row on which one field is the minimum From: Rod Taylor To: edouard.boucher@free.fr Cc: pgsql-sql@postgresql.org In-Reply-To: <20030521011636.GA18831@comploteur.gibbonie.creolie> References: <20030521011636.GA18831@comploteur.gibbonie.creolie> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-jsrsluoVaEdXoVBPCUeU" Organization: Message-Id: <1053479672.24527.5.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 20 May 2003 21:14:33 -0400 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/402 X-Sequence-Number: 13567 --=-jsrsluoVaEdXoVBPCUeU Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Something like this: SELECT a FROM table WHERE B =3D (SELECT min(B) FROM table); On Tue, 2003-05-20 at 21:16, edouard.boucher@free.fr wrote: > Hi, >=20 > i have a table with 2 fields, let's say A and B, both integers. > i would like to select all the A for which the B are minimum >=20 > i'm not sure i am clear, so here is an exemple : >=20 > A | B > 1 | 5 > 2 | 2 > 3 | 3 > 4 | 2 > 5 | 2 >=20 > in this situation, the query should return (2, 4, 5) > as it is very easy to ordre a table, i tought this query would be easy > too, but it is more difficult than it looks like. >=20 > thanks for help >=20 >=20 > Edouard Boucher >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? >=20 > http://archives.postgresql.org --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-jsrsluoVaEdXoVBPCUeU Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA+ytL46DETLow6vwwRApxuAJ9CKx6n6GsZvnIE2PULyBVW1NlfqQCeOLjr xdUQSwtghFF4FgDMbZLjiQM= =lz1o -----END PGP SIGNATURE----- --=-jsrsluoVaEdXoVBPCUeU--