Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 9AE08133616B for ; Fri, 17 Dec 2010 15:02:10 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 58404-06 for ; Fri, 17 Dec 2010 19:02:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from andromeda.neonex.com.br (dns1.neonex.com.br [186.225.19.19]) by mail.postgresql.org (Postfix) with ESMTP id C845A133655C for ; Fri, 17 Dec 2010 15:02:02 -0400 (AST) Received: from [201.20.39.226] (helo=[127.0.0.1]) by andromeda.neonex.com.br with esmtpa (Exim 4.72) (envelope-from ) id 1PTfYy-0003Ki-V5; Fri, 17 Dec 2010 17:01:57 -0200 Message-ID: <4D0BB39A.9040204@planit.com.br> Date: Fri, 17 Dec 2010 17:01:46 -0200 From: "Luiz K. Matsumura" Organization: Plan IT Tecnologia =?ISO-8859-1?Q?Inform=E1tica_Ltda=2E?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; pt-BR; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: pgsql-sql@postgresql.org, jasen@xnet.co.nz Subject: Re: UPDATE in a specific order References: <4D0A28F0.3020205@planit.com.br> In-Reply-To: Content-Type: multipart/alternative; boundary="------------050702020909050108090001" X-Antivirus: avast! (VPS 101217-0, 17/12/2010), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201012/87 X-Sequence-Number: 34923 This is a multi-part message in MIME format. --------------050702020909050108090001 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Thanks for reply, Em 16/12/2010 17:58, Jasen Betts escreveu: >> I need to make update of table1 with data on table2 in the order of id >> of table2 > that looks like EAV. is it? > Err, I donīt know so much about EAV, so I think that isnīt. Iīm just trying to reproduce a calc in a spreeadsheet. >> There are some way to do this with a UPDATE statement ? > to do it with an update statement you need no more than one rows in the > from for each row in the target. > > easiest non update statement approach is probably to use a plpgsql > function with a loop. > > basically you need to find another way to do it. > Ok! I make a function in plpgsql to do it. Thankīs again ! * * --------------050702020909050108090001 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thanks  for reply,

Em 16/12/2010 17:58, Jasen Betts escreveu:
I need to make update of table1 with data on table2 in the order of id
of table2
that looks like EAV. is it?


Err, I don´t know so much about EAV, so I think that isn´t. I´m just trying to reproduce a calc in a spreeadsheet.
There are some way to do this with a UPDATE statement ?
to do it with an update statement you need no more than one rows in the
from for each row in the target.

easiest non update statement approach is probably to use a plpgsql 
function with a loop.

basically you need to find another way to do it.


Ok! I make a function in plpgsql to do it.

Thank´s again !


--------------050702020909050108090001--