Re: EXTERN JOIN with WHEN query - Mailing list pgsql-general

From Richard Huxton
Subject Re: EXTERN JOIN with WHEN query
Date
Msg-id 200306061128.46252.dev@archonet.com
Whole thread Raw
In response to EXTERN JOIN with WHEN query  (javier garcia - CEBAS <rn001@cebas.csic.es>)
List pgsql-general
On Thursday 05 Jun 2003 3:56 pm, javier garcia - CEBAS wrote:
> But in this table there are some inexistents records (some missing days)
> And I would like to create lists with a full list of dates and
> corresponding precipitation data, with gaps when the row didn't exist.
> So; I've created a table with a complete series of dates from 1950 up to
> date, and made the query:
>
>  SELECT fechas.fecha,precipitacion FROM fechas LEFT OUTER JOIN precal41 ON
> (fechas.fecha  = precal41.fecha);
>
> This is perfect. But to make it better,  would like to include just the
> dates from the first one in the precal table. So, I've tried:
>
> SELECT fechas.fecha,precipitacion FROM fechas LEFT OUTER JOIN precal41 ON
> (fechas.fecha  = precal41.fecha) WHEN fechas.fecha >= min(precal41.fecha);

Perhaps something like (not tested):

SELECT .... WHERE fechas.fecha >= (SELECT min(precal41.fecha) FROM precal41);
--
  Richard Huxton

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Create index on the year of a date column
Next
From: Manfred Koizar
Date:
Subject: Re: EXTERN JOIN with WHEN query