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

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -