MySQL - Select while sum is less than x -
i've got list of cached files referenced in database , want purge out oldest outside of size limit of 20,000,000.
table simplistically looks this:
[ hash | filesize | timestamp ]
at moment running following command,
select `hash`, `filesize` `cachetable` order `timestamp` desc;
then processing results externally. there way list of results outside of 20,000,000 limit?
i'd use offset
select `hash`, `filesize` `cachetable` order `timestamp` desc limit <your_limit_here> offset 20000000;
be sure replace your_limit_here own acceptable number.
Comments
Post a Comment