X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 141A29FB3CF for ; Thu, 20 Jul 2006 16:54:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 59828-02-7 for ; Thu, 20 Jul 2006 16:54:30 -0300 (ADT) X-Greylist: delayed 00:27:23.643945 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 527469FB2ED for ; Thu, 20 Jul 2006 12:16:15 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from trabant.cianoz.org (host31-194-149-62.serverdedicati.aruba.it [62.149.194.31]) by svr4.postgresql.org (Postfix) with ESMTP id 7CF115AF035 for ; Thu, 20 Jul 2006 14:48:59 +0000 (GMT) Received: by trabant.cianoz.org (Postfix, from userid 1031) id 8D12238413B; Thu, 20 Jul 2006 16:48:52 +0200 (CEST) Received: from [192.168.0.220] (host170-168.pool8261.interbusiness.it [82.61.168.170]) by trabant.cianoz.org (Postfix) with ESMTP id DAA7A384128 for ; Thu, 20 Jul 2006 16:48:49 +0200 (CEST) Subject: simple problem??? From: ivan marchesini Reply-To: marchesini@unipg.it To: pgsql-sql@postgresql.org Content-Type: text/plain Organization: University of Perugia Date: Thu, 20 Jul 2006 16:52:36 +0200 Message-Id: <1153407157.5192.64.camel@geoivan> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.80 (http://www.clamav.net) X-Archive-Number: 200607/262 X-Sequence-Number: 25836 Dear users.... It's a simple problem I think (and I hope :-) I have a table like this: A|B|C 1|2|20 1|3|10 1|4|21 2|3|12 2|4|22 3|4|23 where the first two column are a combination without repetition (with k=2) of the numbers 1,2,3,4 for each pair I have a value in the column C. I would want a select that can extract these records: 1|3|10 2|3|12 3|4|23 i.e. the select must look into the A field first and: -select all records where A=1, -find, into this selection, the record where there's the minimum value of the field C -print all the fields for this record. then -select all records where A=2 -find, into this selection, the record where there's the minimum value of the field C -print all the fields of this record. and so on... using SELECT a,MIN(c) FROM table GROUP BY a is a partial solution because I can't see the value of B and I obtain: 1|10 2|12 3|23 How can I do for plotting also the value of B??? Thank you very much Ivan -- Ivan Marchesini Department of Civil and Environmental Engineering University of Perugia Via G. Duranti 93/a 06125 Perugia (Italy) e-mail: marchesini@unipg.it ivan.marchesini@gmail.com tel: +39(0)755853760 fax: +39(0)755853756 jabber: geoivan73@jabber.org