Re: EXTERN JOIN with WHEN query

From: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: EXTERN JOIN with WHEN query
Date: 2003-06-06 08:59:24
Message-ID: 200306061059.24511.darko.prenosil@finteh.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Subject: Re: [GENERAL] EXTERN JOIN with WHEN query
Date: Friday 06 June 2003 10:57
From: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
To: javier garcia - CEBAS <rn001(at)cebas(dot)csic(dot)es>

On Thursday 05 June 2003 16:56, javier garcia - CEBAS wrote:
> Hi all;
> This is a query that I guess is not very difficult, but I'm a newbie;
> I've got a lot of tables, each of them with two columns:
>
> SELECT * FROM precal; ->
> (date) (real)
> fecha | precipitacion
> ------------+---------------
> 1996-01-01 | 0.6
> 1996-02-01 | 0.7
> ...
>
>
> 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);
>
> With the answer:
>
> ERROR: parser: parse error at or near "WHEN"
>
> Could you help me with this query?

Maybe WHERE instead of WHEN ?

-------------------------------------------------------

Browse pgsql-general by date

  From Date Subject
Next Message Ruben 2003-06-06 09:22:58 Re: Postmaster only takes 4-5% CPU
Previous Message Henrik Steffen 2003-06-06 08:58:04 update phenomenom