Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id EA68F9FA6B5 for ; Wed, 25 Oct 2006 22:07:40 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 97478-05 for ; Wed, 25 Oct 2006 22:07:38 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web50815.mail.yahoo.com (web50815.mail.yahoo.com [206.190.39.136]) by postgresql.org (Postfix) with SMTP id ED0919FA432 for ; Wed, 25 Oct 2006 22:07:37 -0300 (ADT) Received: (qmail 67475 invoked by uid 60001); 26 Oct 2006 01:07:36 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=LmEzckVkjth62wuVca+BHSjC8IV30NbZJVCc+B7HFIItDhVx4ti2qeuRIFSHQ6JqzGko2Fg5e8NbgxbPgGyq1ksvFPWpzxCtsoJGrJxggQ4qKLzPWSRKcbs3nkxpFd4ZXAcZV5IVcCCG1f8IaLTC4n7iwthMOTVRIeIHMbCrXA0= ; Message-ID: <20061026010736.67473.qmail@web50815.mail.yahoo.com> Received: from [203.134.174.70] by web50815.mail.yahoo.com via HTTP; Wed, 25 Oct 2006 18:07:36 PDT Date: Wed, 25 Oct 2006 18:07:36 -0700 (PDT) From: roopa perumalraja Subject: Add calculated fields from one table to other table To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1775136853-1161824856=:67125" Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.75 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS, HTML_30_40, HTML_MESSAGE X-Spam-Level: *** X-Archive-Number: 200610/208 X-Sequence-Number: 26597 --0-1775136853-1161824856=:67125 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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 --------------------------------- Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business. --0-1775136853-1161824856=:67125 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
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


Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business. --0-1775136853-1161824856=:67125--