I have the following query in my PHP code:
SELECT id, totaldias, totalferiados FROM dias WHERE MONTH(data) = '$mes' ORDER BY totaldias
So far, it works beauty. But I implemented a percentage in the system that works like this: In another query I pick up the person's date of entry into the company, and count how many days she has worked since she came in, and shot the percentage of how many days she was on duty. game on the table. But how to order from who took more duty for what took less? But the calculation is done outside the query, how do I get it sorted?