From: Rod Taylor <rbt@rbt.ca>
To: edouard.boucher@free.fr
Cc: pgsql-sql@postgresql.org
Subject: Re: selecting entire row on which one field is the minimum
Date: 20 May 2003 21:14:33 -0400
Message-ID: <1053479672.24527.5.camel@jester> (raw)
In-Reply-To: <20030521011636.GA18831@comploteur.gibbonie.creolie>
References: <20030521011636.GA18831@comploteur.gibbonie.creolie>
Something like this:
SELECT a FROM table WHERE B = (SELECT min(B) FROM table);
On Tue, 2003-05-20 at 21:16, edouard.boucher@free.fr wrote:
> Hi,
>
> 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
>
> i'm not sure i am clear, so here is an exemple :
>
> A | B
> 1 | 5
> 2 | 2
> 3 | 3
> 4 | 2
> 5 | 2
>
> 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.
>
> thanks for help
>
>
> Edouard Boucher
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org--
Rod Taylor <rbt@rbt.ca>
PGP Key: http://www.rbt.ca/rbtpub.ascAttachments:
signature.asc (application/pgp-signature, 186B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: rbt@rbt.ca, edouard.boucher@free.fr
Subject: Re: selecting entire row on which one field is the minimum
In-Reply-To: <1053479672.24527.5.camel@jester>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox