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 83C3B3A2B3E for ; Mon, 20 Dec 2004 09:13:53 +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 67913-01 for ; Mon, 20 Dec 2004 09:13:46 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id 9889A3A2990 for ; Mon, 20 Dec 2004 09:13:44 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) id 1CgJbo-00004T-DI; Mon, 20 Dec 2004 09:13:43 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id A8B6216331; Mon, 20 Dec 2004 09:13:25 +0000 (GMT) Message-ID: <41C697B8.9030700@archonet.com> Date: Mon, 20 Dec 2004 09:13:28 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mark Collette Cc: pgsql-sql@postgresql.org Subject: Re: Updating column to link one table to another References: <114A1D38-4E81-11D9-BAA1-0050E4799418@hyperbyte.ab.ca> In-Reply-To: <114A1D38-4E81-11D9-BAA1-0050E4799418@hyperbyte.ab.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.085 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/138 X-Sequence-Number: 19758 Mark Collette wrote: > > Now, I've added the infrequentId columns to both, as an optimization, so > that I can quickly find the InfrequentTable entry for a given > FrequentTable entry. I've done this because I want to speed up > SELECTs. Any new INSERTs are working just fine. But, all my legacy > entries, are not linked up yet. I need to know how I can UPDATE the > FrequentTable rows, where their infrequentId is zero, to point at the > last InfrequentTable entry whose timestamp ts is before its own > timestamp ts. How do you distinguish between InfrequentTable entries when their timestamp is the same? -- Richard Huxton Archonet Ltd