Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1338F476FE1 for ; Fri, 13 Dec 2002 12:44:25 -0500 (EST) Received: from natura.cebas.csic.es (natura.cebas.csic.es [161.111.146.9]) by postgresql.org (Postfix) with ESMTP id BBBB4476F8A for ; Fri, 13 Dec 2002 12:44:22 -0500 (EST) Received: from natura.cebas.csic.es (localhost.localdomain [127.0.0.1]) by natura.cebas.csic.es (8.11.6/8.11.6) with ESMTP id gBDHcD828803 for ; Fri, 13 Dec 2002 18:38:13 +0100 Received: from there (equipo97.cebas.csic.es [161.111.146.97]) by natura.cebas.csic.es (8.11.6/8.11.6) with SMTP id gBDHcCQ28797 for ; Fri, 13 Dec 2002 18:38:13 +0100 Message-Id: <200212131738.gBDHcCQ28797@natura.cebas.csic.es> Content-Type: text/plain; charset="iso-8859-15" From: javier garcia Organization: CEBAS-CSIC To: "pgsql-sql@postgresql.org" Subject: UPDATE comparing dates and non-dates data Date: Fri, 13 Dec 2002 18:43:59 +0100 X-Mailer: KMail [version 1.3.2] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/178 X-Sequence-Number: 10766 Hi; I've got date data, extracted from rain gauge stations. The date of a row in my data are structured in three integer fields, and as a result of a query I can get the following (what is quite good for my): cod_station | year | month | day | rain -------------+------+-------+-----+------ 7250 | 1933 | 8 | 1 | 45 7250 | 1933 | 8 | 2 | 3 7250 | 1933 | 8 | 3 | 0 ... and this for several rain station for about forty years. My problem is that I need to find missing data (a missing data here is a non-existent row). I think I could prepare a table with a complete series of date field, and ALTER it to ADD aditional fields for every station I need to add: date | stat_7250 | stat_7237 ... ----------------+--------------------+---------------+------... 1/11/1999 2/12/1999 ... , and make an UPDATE that in someway, will compare the "date" of this table with an extracted date from "year", "day" and "rain" from the aforementioned SELECT, leaving the non-coincident dates in blank and filling the rain data of the coincident dates. Is this possible? How? Please help. Thank you for any possible advice -- A. Javier García Water and Soil Conservation Department CEBAS-CSIC Apartado 4195 30080 Murcia Spain Tel.: +34 968 39 63 90 Fax: +34 968 39 62 13