Tell me more ×  I've created a table that holds items according
to categories:  | category   | varchar(30)         | YES  | MUL
| NULL              |                | | timestamp  | timestamp
| NO   |     | CURRENT_TIMESTAMP |                | | data
| mediumblob          | YES  |     | NULL              |
|  Old data is deleted using a sliding window technique, meaning
that only the last N items in each category are kept in the
table.  How can I keep track the total number of the items per
category, and the timestamp of the first item in the category?
Edit - COUNT and MIN on the original table won't work, because
this is a Sliding Window data structure meaning that the first
items have already been deleted.  share|improve this question
can't you create a table that holds the counter and the first
data? –  今 草 顿 웃 Aug 13 '12 at 13:09 I can. I'm struggling with
the stored procedure that populates the other table. –  Adam
Matan Aug 13 '12 at 13:48 add comment  2 Answers  up vote