Update counter when row SELECT'd ... ?

From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Update counter when row SELECT'd ... ?
Date: 2006-03-21 03:07:37
Message-ID: 20060320230344.Y1178@ganymede.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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(at)hub(dot)org Yahoo!: yscrappy ICQ: 7615664

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Daniel CAUNE 2006-03-21 03:33:22 Re: Update counter when row SELECT'd ... ?
Previous Message Jeff Frost 2006-03-20 23:52:43 Re: Power cut and performance problem