X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3B1EAF001F for ; Sat, 7 Jun 2003 18:06:27 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 49704-02 for ; Sat, 7 Jun 2003 18:06:16 +0000 (GMT) Received: from smtp.noos.fr (nan-smtp-03.noos.net [212.198.2.72]) by svr1.postgresql.org (Postfix) with ESMTP id 1B175F0067 for ; Sat, 7 Jun 2003 18:05:18 +0000 (GMT) Received: (qmail 3751621 invoked by uid 0); 7 Jun 2003 18:05:17 -0000 Received: from unknown (HELO gmendola) ([212.198.40.246]) (envelope-sender ) by 212.198.2.72 (qmail-ldap-1.03) with SMTP for ; 7 Jun 2003 18:05:17 -0000 Message-ID: <004901c32d1f$58260a70$10d4a8c0@mm.eutelsat.org> From: "Mendola Gaetano" To: "javier garcia - CEBAS" , "pgsql-sqL" References: <200306051042.h55AgCI27558@natura.cebas.csic.es> Subject: Re: EXTERN JOIN with WHEN query Date: Sat, 7 Jun 2003 20:05:13 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200306/62 X-Sequence-Number: 13820 I didn't read all the entire problem but try to use WHERE instead of WHEN. Regards Gaetano Mendola ----- Original Message ----- From: "javier garcia - CEBAS" To: "pgsql-sqL" Sent: Thursday, June 05, 2003 12:55 PM Subject: [SQL] EXTERN JOIN with WHEN query > Hi all; > This is a query that I guess is not very dificult, 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? > > Thanks and regards > > Javier > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >