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' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -