1
I have the following query in my PHP code:
SELECT id, totaldias, totalferiados FROM dias WHERE MONTH(data) = '$mes' ORDER BY totaldias
So far, so good. But I implemented in the system a percentage that works as follows: In another query I take the person’s date of entry into the company, and count how many days she has worked since entering, and I shoot the percentage of how many days she was on duty and play on the table. But how to order from who took more duty to what you took less? But the calculation is done outside the query, how do I get order?
Make this calculation within your query.
– gmsantos
"Play on the table"? If the dice is on the table, just sort by it.
– bfavaretto
In the table I mentioned was the php table. Sorry. I will try to do the calculation inside the query itself.
– João Neto
If you calculate % with PHP, use it to sort. Enter the code you are using
– Papa Charlie
Without seeing the rest of your code it is difficult to help, but you could do everything as a single query, including calculating the percentage and using a
ORDER BY
to sort. Post the other query and the percentage calculation to help you better.– Marcos
Later I will post, is that stayed at work. But I will post more.
– João Neto
Did you find a solution? Poste as an answer to help other people.
– Maniero
The project I was working on was canceled and I haven’t tested the solution anymore.
– João Neto