Received: from wm.hub.org (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 624639FB1DD for ; Sun, 29 Oct 2006 01:53:02 -0400 (AST) Received: from maia (wm.hub.org [200.46.204.128]) by wm.hub.org (Postfix) with ESMTP id 5BAE2DF9A71 for ; Sun, 29 Oct 2006 05:53:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web54305.mail.yahoo.com (web54305.mail.yahoo.com [206.190.49.115]) by postgresql.org (Postfix) with SMTP id DA7219FA2A9 for ; Thu, 26 Oct 2006 12:29:01 -0300 (ADT) Received: (qmail 21559 invoked by uid 60001); 26 Oct 2006 15:29:01 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=GOTi2BB2ZZNXUSlVg3kS6QvTeSW61ij6kM6LawzYvBCfoSvbU2JcCek+csoJk4GmzRPtNdCIEPKXZQBEHK7TDclVZK2AJes/kgULf8XKZrzPQmqFxrrtLIqpj3pdVoNGDO2eLrtmKuGXJBihznZlZfPrgdfYplmVFdlTKczianA= ; Message-ID: <20061026152900.21557.qmail@web54305.mail.yahoo.com> Received: from [68.35.2.64] by web54305.mail.yahoo.com via HTTP; Thu, 26 Oct 2006 08:29:00 PDT Date: Thu, 26 Oct 2006 08:29:00 -0700 (PDT) From: chester c young Subject: Re: Add calculated fields from one table to other table To: roopa perumalraja Cc: sql pgsql In-Reply-To: <20061026010736.67473.qmail@web50815.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1586081451-1161876540=:18269" Content-Transfer-Encoding: 8bit X-Archive-Number: 200610/232 X-Sequence-Number: 26621 --0-1586081451-1161876540=:18269 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit roopa perumalraja wrote: Hi I have two tables. Tick table has fields like ticker, time, price & volume and Timeseries table has fields like ticker, time, avg_price, avg_volume. The time field in Timeseries table is different from time in tick table, its the timeseries for every minute. Now I want to calculate the average price & volume from tick table for each ticker and for every minute and add those fields to timeseries table. Can anyone please help me out with the sql query. Note: The ticker in the tick table also has duplicate values, so i am not able to create relation between two tables. Thanks in advance Roopa --------------------------------- You can't get there from here. It is like saying a hitter has a .250 average and in this game he was 2 for 4, what's his average? Timeseries must also have quantity and price, just as you would need to know number of bats and hits for the baseball player. --------------------------------- Want to be your own boss? Learn how on Yahoo! Small Business. --0-1586081451-1161876540=:18269 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit roopa perumalraja <roopabenzer@yahoo.com> wrote:
Hi
 
I have two tables. Tick table has fields like ticker, time, price & volume and Timeseries table has fields like ticker, time, avg_price, avg_volume.
 
The time field in Timeseries table is different from time in tick table, its the timeseries for every minute. Now I want to calculate the average price & volume from tick table for each ticker and for every minute and add those fields to timeseries table. Can anyone please help me out with the sql query.
 
Note: The ticker in the tick table also has duplicate values, so i am not able to create relation between two tables.
 
Thanks in advance
Roopa

You can't get there from here.  It is like saying a hitter has a .250 average and in this game he was 2 for 4, what's his average?  Timeseries must also have quantity and price, just as you would need to know number of bats and hits for the baseball player.


Want to be your own boss? Learn how on Yahoo! Small Business. --0-1586081451-1161876540=:18269--