X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 824719DD43D for ; Mon, 20 Mar 2006 23:07:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48921-03 for ; Mon, 20 Mar 2006 23:07:35 -0400 (AST) Received: from hub.org (hub.org [200.46.204.220]) by postgresql.org (Postfix) with ESMTP id 9D4399DD44C for ; Mon, 20 Mar 2006 23:07:29 -0400 (AST) Received: from localhost (unknown [200.46.204.144]) by hub.org (Postfix) with ESMTP id 9116D62CB04 for ; Mon, 20 Mar 2006 23:07:35 -0400 (AST) Received: from hub.org ([200.46.204.220]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48676-03 for ; Mon, 20 Mar 2006 23:07:33 -0400 (AST) Received: from ganymede.hub.org (blk-222-82-85.eastlink.ca [24.222.82.85]) by hub.org (Postfix) with ESMTP id 8191262CB02 for ; Mon, 20 Mar 2006 23:07:33 -0400 (AST) Received: by ganymede.hub.org (Postfix, from userid 1000) id EFE065D619; Mon, 20 Mar 2006 23:07:37 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id EBD9B4A8E1 for ; Mon, 20 Mar 2006 23:07:37 -0400 (AST) Date: Mon, 20 Mar 2006 23:07:37 -0400 (AST) From: "Marc G. Fournier" X-X-Sender: scrappy@ganymede.hub.org To: pgsql-sql@postgresql.org Subject: Update counter when row SELECT'd ... ? Message-ID: <20060320230344.Y1178@ganymede.hub.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.546 required=5 tests=[AWL=0.067, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.546 X-Spam-Level: X-Archive-Number: 200603/320 X-Sequence-Number: 24666 I have a simple table: name, url, counter I want to be able to do: SELECT * FROM table ORDER BY counter limit 5; But, I want counter to be incremented by 1 *if* the row is included in that 5 ... so that those 5 basically move to the bottom of the list, and the next 5 come up ... I've checked CREATE TRIGGER, and that doesn't work 'ON SELECT' ... is there anything that I *can* do, other then fire back an UPDATE based on the records I've received? Thanks ... ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664