[MySQL] Efficiently store last X records per item
- by Saif Bechan
I want to store the last X records in an MySQL database in an efficient way. So when the 4th record is stored the first should be deleted.
The way I do this not is first run a query getting the items. Than check what I should do then insert/delete.
There has to be a better way to do this. Any suggestions?
Edit
I think I should add that the…