Re: EXTERN JOIN with WHEN query

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: javier garcia - CEBAS <rn001(at)cebas(dot)csic(dot)es>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: EXTERN JOIN with WHEN query
Date: 2003-06-06 09:37:32
Message-ID: c3n0evk0p3g4v4ehk318vu5ugoiscaj655@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 5 Jun 2003 16:56:54 +0200, javier garcia - CEBAS
<rn001(at)cebas(dot)csic(dot)es> wrote:
>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"

The keyword is "WHERE". And I guess the WHERE clause has to be

WHERE fechas.fecha >= (SELECT min(fecha) FROM precal41)

or, if there is an index on precal41.fecha, more efficiently but
non-standard

WHERE fechas.fecha >= (SELECT fecha
FROM precal41 ORDER BY fecha LIMIT 1)

HTH.
Servus
Manfred

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2003-06-06 10:28:46 Re: EXTERN JOIN with WHEN query
Previous Message Nick Barr 2003-06-06 09:34:28 Re: Create index on the year of a date column