I want to order a result by fieldx * fieldy, for example:
Row 1: fieldx = 10 fieldy = 10 Total: 100
Row 2: fieldx = 11 fieldy = 5 Total: 55
Row 1 has to appear first. Couldn't find anything about it. It's for a codeIgniter project, so if there is a solution with that I'm very happy.
Thanks!
It's okay to do math in the order by clause:
select *
from YourTable
order by fieldx * fieldy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With