From: Marc G. Fournier <scrappy@postgresql.org>
To: pgsql-sql@postgresql.org
Subject: Update counter when row SELECT'd ... ?
Date: Mon, 20 Mar 2006 23:07:37 -0400 (AST)
Message-ID: <20060320230344.Y1178@ganymede.hub.org> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: scrappy@postgresql.org
Subject: Re: Update counter when row SELECT'd ... ?
In-Reply-To: <20060320230344.Y1178@ganymede.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox