Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EC0F447714C for ; Fri, 13 Dec 2002 15:53:37 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id A6B2E4770F7 for ; Fri, 13 Dec 2002 15:52:43 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2280567; Fri, 13 Dec 2002 12:53:10 -0800 Content-Type: text/plain; charset="iso-8859-15" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: javier garcia , "pgsql-sql@postgresql.org" Subject: Re: UPDATE comparing dates and non-dates data Date: Fri, 13 Dec 2002 12:56:31 -0800 X-Mailer: KMail [version 1.4] References: <200212131738.gBDHcCQ28797@natura.cebas.csic.es> In-Reply-To: <200212131738.gBDHcCQ28797@natura.cebas.csic.es> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212131256.31574.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/185 X-Sequence-Number: 10773 On Friday 13 December 2002 09:43, javier garcia wrote: > Hi; > I've got date data, extracted from rain gauge stations. The date of a row= in=20 > my data are structured in three integer fields, and as a result of a quer= y I=20 > 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 > ...=20 > and this for several rain station for about forty years. My problem is th= at=20 I=20 > need to find missing data (a missing data here is a non-existent row). >=20 > I think I could prepare a table with a complete series of date field, and= =20 > ALTER it to ADD aditional fields for every station I need to add: >=20 > date | stat_7250 | stat_7237 ... > ----------------+--------------------+---------------+------... > 1/11/1999 > 2/12/1999 > ... > , and make an UPDATE that in someway, will compare the "date" of this tab= le=20 > with an extracted date from "year", "day" and "rain" from the aforementio= ned=20 > SELECT, leaving the non-coincident dates in blank and filling the rain da= ta=20 > of the coincident dates. Is this possible? How? I don't think this is the best method to find missing dates. However, I'm = a=20 little confused as to what you consider a "missing" date. Could you be mor= e=20 explicit? --=20 -Josh Berkus Aglio Database Solutions San Francisco