Re: EXTERN JOIN with WHEN query

From: Richard Huxton <dev(at)archonet(dot)com>
To: javier garcia - CEBAS <rn001(at)cebas(dot)csic(dot)es>, pgsql-general(at)postgresql(dot)org
Subject: Re: EXTERN JOIN with WHEN query
Date: 2003-06-06 10:28:46
Message-ID: 200306061128.46252.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2003-06-06 10:34:01 Re: Create index on the year of a date column
Previous Message Manfred Koizar 2003-06-06 09:37:32 Re: EXTERN JOIN with WHEN query