I am trying to get the maximum record after the value minus 2 columns. I can make this request on phpMyAdmin
SELECT `storage_id`, `host` FROM `storages`
WHERE size - used = (SELECT MAX(size - used) FROM `storages`
but struggling with the consequences. Any help?
Updated:
I updated my query and now it is easier than the previous one.
SELECT `storage_id`, `host`, size - used AS free FROM `storages` ORDER BY free DESC LIMIT 1
source
share