If you use an auto_increment column (e.g. id int auto_increment) then
your trigger could do something like this:
DELETE FROM table WHERE id < new.id - 100;
On Aug 30, 2006, at 3:49 PM, Dan Buettner wrote:
You could accomplish this with a trigger on the table - on INSERT,
execute a DELETE statement.
http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html
You would need to find a way to identify which is the "bottom" record
to be deleted ... I might use an ID column, and consider the
lowest-numbered row as the "bottom" one. You might also need to
include a condition so that it does not start deleting records until
you've reached the appropriate number of records in the table, or if
your database is slow-moving, you could simply create the trigger once
you have the appropriate number.
HTH,
Dan
On 8/29/06, Tanner Postert <[EMAIL PROTECTED]> wrote:
sorry for the double post.
if i want to have a row of about 100 records. and everytime i
insert a new
record, it gets pushed on the top, and the bottom one gets pushed
out, sort
of like a heap. is this possible?
i know i can just delete the record, etc, but i was wondering if
there was a
built in way of doing it.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]