Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id F025C9FBC6D for ; Thu, 22 Mar 2007 10:50:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 26498-03-7 for ; Thu, 22 Mar 2007 10:50:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from correio2.docasdoporto.com.br (8.144.199.200.docasdoporto.com.br [200.199.144.8]) by postgresql.org (Postfix) with ESMTP id E6C3D9FBC62 for ; Thu, 22 Mar 2007 10:50:21 -0300 (ADT) Received: from [201.30.172.2] (account ezequias@fastcon.com.br HELO [192.168.0.110]) by correio2.docasdoporto.com.br (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 47098303 for pgsql-sql@postgresql.org; Thu, 22 Mar 2007 11:07:55 -0300 Message-ID: <46028915.1030102@fastcon.com.br> Date: Thu, 22 Mar 2007 10:48:05 -0300 From: "Ezequias R. da Rocha" User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Subqueryes Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/297 X-Sequence-Number: 27935 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; -- Atenciosamente Ezequias Rodrigues da Rocha