views:

57

answers:

1

Hello There,

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!

+1  A: 

It's okay to do math in the order by clause:

 select *
 from YourTable
 order by fieldx * fieldy
Andomar
Lol, that's easy. Thanks for your time!
Kees