X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E412A3A4EBA for ; Sat, 22 Jan 2005 12:52:07 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30786-05 for ; Sat, 22 Jan 2005 12:52:01 +0000 (GMT) Received: from hotmail.com (bay13-f3.bay13.hotmail.com [64.4.31.3]) by svr1.postgresql.org (Postfix) with ESMTP id 618543A4EBE for ; Sat, 22 Jan 2005 12:52:01 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sat, 22 Jan 2005 04:52:00 -0800 Message-ID: Received: from 82.233.117.145 by by13fd.bay13.hotmail.msn.com with HTTP; Sat, 22 Jan 2005 12:51:20 GMT X-Originating-IP: [82.233.117.145] X-Originating-Email: [a_eti@hotmail.com] X-Sender: a_eti@hotmail.com Reply-To: mrblonde@locked.myftp.org From: "adam etienne" To: pgsql-sql@postgresql.org Subject: update from multiple rows Date: Sat, 22 Jan 2005 12:51:20 +0000 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp; format=flowed X-OriginalArrivalTime: 22 Jan 2005 12:52:00.0802 (UTC) FILETIME=[2A28B820:01C50081] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.376 tagged_above=0 required=5 tests=DNS_FROM_RFC_POST, MSGID_FROM_MTA_HEADER X-Spam-Level: * X-Archive-Number: 200501/193 X-Sequence-Number: 19981 hi I have some trouble updating a table like this one : date | data_raw | data_sys 12-01 | 5 | 4.5 13-01 | 6 | 6 14-01 | 7 | 8 I would like to update the 'data_sys' row by computing values of multiple 'data_raw' values. I mean for example : data_sys(13-01) = (data_raw['12-01'] + data_raw['13-01'] + data_raw['14-01'] )/3; I thought of a function that fetch the 3 data_raw rows for each rows.... but it was obviously too much slow... Is there a more efficient way to achieve this ? Thanks in advance.. This could help me very much.. Etienne Adam _________________________________________________________________ 無料メールならやっぱり 「MSN Hotmail」 http://www.hotmail.com/