Autopruning after a specified amount of row are created?
Posted
by Rob
on Stack Overflow
See other posts from Stack Overflow
or by Rob
Published on 2010-05-09T05:16:28Z
Indexed on
2010/05/09
5:18 UTC
Read the original article
Hit count: 145
Basic question, sorry. Basically, I have a script that creates a MySQL entry each time someone visits the page. A logging script. However, I want to make it autoprune after, say, 100 visits.
For example in pseudo code:
if amount of rows > 100 {
delete rows 1+ until amount of rows == 100 }
So in a nutshell, each time a new row is added after 100, it needs to automatically remove the row with the smallest id (My primary key).
© Stack Overflow or respective owner