pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: yaubi@yaubi.com
To: pgsql-sql@postgresql.org
Subject: Which SQL query makes it possible to optain the 3 greatest values of an interger list ?
Date: 12 Sep 2001 01:41:13 -0700
Message-ID: <70c8063b.0109120041.5fc5d0d1@posting.google.com> (raw)

OO( Sql Problem )Oo. 

That is to say a table of 5 inputs of 1 integer field : 

   Table = { (1); (12); (3); (9); (4) }

We want to obtain a result of 1 input of 3 fields, 
corresponding to the 3 greatest values of Table, 
by descending order : 

   Result = { (12; 9; 4) } 

=> Which SQL query makes it possible to obtain Result from Table ?
We certainly need to use sub-queries, but how ?

Thank you in advance for your help !

Yoann AUBINEAU



view thread (3+ messages)  latest in thread

Message-ID: <70c8063b.0109120041.5fc5d0d1@posting.google.com>
Permalink:  ../70c8063b.0109120041.5fc5d0d1@posting.google.com/
Also on:    postgresql.org/message-id/70c8063b.0109120041.5fc5d0d1@posting.google.com

 · 

reply

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: yaubi@yaubi.com
  Subject: Re: Which SQL query makes it possible to optain the 3 greatest values of an interger list ?
  In-Reply-To: <70c8063b.0109120041.5fc5d0d1@posting.google.com>

* 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