Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 8E5089FB930 for ; Thu, 22 Mar 2007 10:57:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 95995-03-8 for ; Thu, 22 Mar 2007 10:56:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 28E759FBC15 for ; Thu, 22 Mar 2007 10:56:50 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-219-96.bk12-dsl.surnet.cl [201.221.219.96]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l2MDudeU031627; Thu, 22 Mar 2007 06:56:40 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 75F95329EA; Thu, 22 Mar 2007 09:56:39 -0400 (CLT) Date: Thu, 22 Mar 2007 09:56:39 -0400 From: Alvaro Herrera To: "Ezequias R. da Rocha" Cc: pgsql-sql@postgresql.org Subject: Re: Subqueryes Message-ID: <20070322135639.GE4102@alvh.no-ip.org> Mail-Followup-To: "Ezequias R. da Rocha" , pgsql-sql@postgresql.org References: <46028915.1030102@fastcon.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46028915.1030102@fastcon.com.br> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV 0.88.5/2865/Sun Mar 18 08:27:48 2007 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Thu, 22 Mar 2007 06:56:43 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/298 X-Sequence-Number: 27936 Ezequias R. da Rocha wrote: > Hi list, > > I must add some days (i.e:365) to my current_date and put it in my table > (an UPDATE). By now, it is simple but my "days to add" is in another table. > > How could I do this kind of update > > My sql is like this (but is not working): > > update myTable > set date = (current_date + (Select daysToAdd from base.Table1 where > myFKey_id = Table1Id) ) > where Expire_Date = now()::Date; So what is the error message? -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.