Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 63007476185 for ; Thu, 19 Dec 2002 11:17:06 -0500 (EST) Received: from natura.cebas.csic.es (natura.cebas.csic.es [161.111.146.9]) by postgresql.org (Postfix) with ESMTP id F2178476020 for ; Thu, 19 Dec 2002 11:17:03 -0500 (EST) Received: from natura.cebas.csic.es (localhost.localdomain [127.0.0.1]) by natura.cebas.csic.es (8.11.6/8.11.6) with ESMTP id gBJGAd801980 for ; Thu, 19 Dec 2002 17:10:39 +0100 Received: from there (equipo97.cebas.csic.es [161.111.146.97]) by natura.cebas.csic.es (8.11.6/8.11.6) with SMTP id gBJGAbQ01971; Thu, 19 Dec 2002 17:10:38 +0100 Message-Id: <200212191610.gBJGAbQ01971@natura.cebas.csic.es> Content-Type: text/plain; charset="iso-8859-2" From: javier garcia Organization: CEBAS-CSIC To: Christoph Haller Subject: Re: UPDATE with a SELECT and subSELECT(About comparing dates and non dates data) Date: Thu, 19 Dec 2002 17:16:45 +0100 X-Mailer: KMail [version 1.3.2] References: <3DFEEFB1.371BA57C@rodos.fzk.de> In-Reply-To: <3DFEEFB1.371BA57C@rodos.fzk.de> Cc: "pgsql-sql@postgresql.org" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/243 X-Sequence-Number: 10831 Thanks Christoph; Typing what you told me there was an errror; I' ve changed it slightly an it seems that this sintax is correct. I say "it seems" because the computer begins to process the query but doesn't finish it. I've leaved it working for more than half an hour, before cancel it, with no result. Thank you anyway. This is what I think is a good sintax for UPDATE - SELECT - SUBSELECT. Perhaps in mor simple cases it works. May someone is interested in it. ---------- Javier -------------------------------------------------------------------- UPDATE series_lluvia SET st7237=( SELECT rain FROM ( SELECT cod_variable, cod_station, year, month, 1 as day, rain_day1 as rain FROM pluviometria WHERE ten=1 UNION ALL ... SELECT cod_variable, cod_station, year, month, 31 as day, rain_day11 as rain FROM pluviometria WHERE ten=3 AND rain_day11 IS NOT NULL ORDER BY cod_station, year, month, day) AS temp WHERE cod_station=7237) AS temp2 WHERE series_lluvia.year=temp2.year AND series_lluvia.month=temp2.month AND series_lluvia.day=temp2.day); ------------------------------------------------------