Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 913809FB2F8 for ; Wed, 1 Nov 2006 01:51:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 41278-05 for ; Wed, 1 Nov 2006 05:51:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31808.mail.mud.yahoo.com (web31808.mail.mud.yahoo.com [68.142.207.71]) by postgresql.org (Postfix) with SMTP id C86C39FB2E1 for ; Wed, 1 Nov 2006 01:51:13 -0400 (AST) Received: (qmail 51130 invoked by uid 60001); 1 Nov 2006 05:51:13 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=cBZnU4786uPCvEVtSA3vytssS+oPVHwu5KjrsL5e47LMISPU+653j71OUJlxv/qFoO8LyaFgLEeznKOzRKRbMyvM0ndjOpgqDv6jJXuZb50LO40nNgmJwqOeaHw8jtJCfMNGNE1mdflWGERmjMEqDSmr3/lkPx87aXv8JiPijbQ= ; X-YMail-OSG: mjMdZC8VM1n4ZCfMW31l_dp.RgMHu4pLlWqbav8arnE1C43s3wCi33Q5Xcb4aE3xQwcF9T8yxf4SmIyK8gAiuCDlIACH2N6z96pDkOFxYtBJ6aKflPf4Hew3SPe1W4LrSUaJgGxh0Q7jqqxM9rzkmfS7RuJfiAf44RJN1BoLm2BUIBx3Nm8nqiO42hd_ Received: from [24.54.196.198] by web31808.mail.mud.yahoo.com via HTTP; Tue, 31 Oct 2006 21:51:12 PST Date: Tue, 31 Oct 2006 21:51:12 -0800 (PST) From: Richard Broersma Jr Subject: Re: Add calculated fields from one table to other table To: roopa perumalraja , pgsql-sql@postgresql.org In-Reply-To: <20061101035440.76569.qmail@web50809.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <50323.50500.qm@web31808.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.756 tagged_above=0 required=5 tests=BAYES_00, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200611/1 X-Sequence-Number: 26653 > Hi Richard, > > Thanks a lot. I still am not able to get the result for all the rics in the ticks table but I > am able to get the result for a particular ric. > > Can you help me with getting the result for all the rics in the ticks table > > Thanks > Roopa Could you send create table statements for the tables you are working on, and a few insert statements for each table to have sample data. then show what you want the query results to look like. But from what you stated in your previous emails here is what I gather: maybe it might work? select tk.ric as ric, tm.times_time as minute, --timestamps by minutes count(tk.*) as , ... from times tm left join ticks tk on (tm.times_time = date_trunc('minutes', tk.time)) group by ric, minute order by minute;