Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f8C8nZ781807 for ; Wed, 12 Sep 2001 04:49:35 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f8C8fES04008 for pgsql-sql@postgresql.org; Wed, 12 Sep 2001 04:41:14 -0400 (EDT) (envelope-from news) From: yaubi@yaubi.com (Yoann) X-Newsgroups: comp.databases.postgresql.sql 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 Organization: http://groups.google.com/ Lines: 18 Message-ID: <70c8063b.0109120041.5fc5d0d1@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-sql@postgresql.org X-Archive-Number: 200109/85 X-Sequence-Number: 4740 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