
You could create a view that selects the last six rows in reverse and then call the view whenever you want to get the data. On Fri, Sep 24, 2010 at 1:27 PM, Haggai Nyang <haggai.nyang@gmail.com>wrote:
If you use a primary key int id that's set to auto_increment you can do a SELECT query that orders by id in reverse, limiting to the last 6 results like so (I admit you'll need something to call this query repeatedly - like a perl/php script called by a cron job - hence the 'static' nature):
SELECT * FROM db.table ORDER BY id DESC LIMIT 0,6;
Other than that then you can use triggers on row inserts or updates...but I'm also investigating this one. A trigger looks like a better solution :)
If you go the cron way you'll need to have a way to track the last row that was worked on - probably store the row id in another field or in a variable in the script - and since you can call scripts in 60sec intervals from cron you can have a loop in the script that runs and sleeps on each iteration for about 1k milliseconds (or less)...hope you get the drift...
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Regards Brian Ngure