Which SQL query makes it possible to optain the 3 greatest values of an interger list ?

From: yaubi(at)yaubi(dot)com (Yoann)
To: pgsql-sql(at)postgresql(dot)org
Subject: Which SQL query makes it possible to optain the 3 greatest values of an interger list ?
Date: 2001-09-12 08:41:13
Message-ID: 70c8063b.0109120041.5fc5d0d1@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Olle Wijk 2001-09-12 09:06:06 How do I extract ONE particular field, when multiple table contain the same field name?
Previous Message Miguel González 2001-09-12 07:51:46 Re: SQL Query