pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: javier garcia <andresjavier.garcia@wanadoo.es>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: UPDATE comparing dates and non-dates data
Date: Fri, 13 Dec 2002 18:43:59 +0100
Message-ID: <200212131738.gBDHcCQ28797@natura.cebas.csic.es> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <200212131738.gBDHcCQ28797@natura.cebas.csic.es>
Permalink:  ../200212131738.gBDHcCQ28797@natura.cebas.csic.es/
Also on:    postgresql.org/message-id/200212131738.gBDHcCQ28797@natura.cebas.csic.es

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andresjavier.garcia@wanadoo.es
  Subject: Re: UPDATE comparing dates and non-dates data
  In-Reply-To: <200212131738.gBDHcCQ28797@natura.cebas.csic.es>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox