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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -