X-Original-To: pgsql-general@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D7B2D47A309; Fri, 31 Jan 2003 18:25:30 -0500 (EST) Received: from ns.minardi.com.mx (ns.minardi.com.mx [148.223.125.238]) by postgresql.org (Postfix) with ESMTP id 6957847E64E; Fri, 31 Jan 2003 16:21:15 -0500 (EST) Received: from heracles.santarita.intranet (heracles.santarita.intranet [192.168.1.105]) (authenticated (0 bits)) by ns.minardi.com.mx (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h0VLLE711264; Fri, 31 Jan 2003 15:21:14 -0600 Subject: For each record in SELECT From: Luis =?ISO-8859-1?Q?Maga=F1a?= Reply-To: joe666@gnovus.com To: PostgreSQL General , PostgreSQL Novice , PostgreSQL SQL Content-Type: text/plain; charset=ISO-8859-1 Organization: Gnovus Networks & Software Message-Id: <1044048077.1380.3.camel@kerberus> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 31 Jan 2003 15:21:17 -0600 X-Scanned-By: MIMEDefang 2.12 (www dot roaringpenguin dot com slash mimedefang) Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/1609 X-Sequence-Number: 36730 Hi, I have a question here: I have a table with this fields: month description amount now I have to write a query that retrieves the sum of the amount from the minimum month to the maximum month registered for each diferent description. Of course there are cases when a particular description has not record for all the months in that period. I mean, suppouse you have this records: month description amount ----------------------------------------------- June description1 100=09 July description1 500 August description1 600 June description2 300 August description2 400 how you write a query that outputs something like this: June July August ------------------------------------------ description1 | 100 500 600 description2 | 300 0 400 My problem is for the 0 value. I hope I've explained clearly my question. Thanks for the help. Best Regards. --=20 Luis Maga=F1a. Gnovus Networks & Software. www.gnovus.com