I tried doing that in one trial run, and I wasn't getting the $200 figure so
I gave up on that.
It seems like doing an order by that statement wouldn't have given me the
sort I wanted.
Don't know why that is though - in theory you should be right, I can try it
a bit more if your curious.
From: Paul DuBois [mailto:paul@stripped]
Sent: Thursday, April 29, 2004 12:28 PM
To: Yoed Anis; mysql@stripped
Subject: Re: Order by price?
At 12:14 -0500 4/29/04, Yoed Anis wrote:
>I'm having trouble with this query:
>as price FROM table ORDER BY price
>A note first. The column "establishments" is an int(10), as you see I
>am taking this number through a formula, and I want the result of this
>formula to be rounded to two decimal places, and to stick a "$" sign in
>front of it so I can easily display it on a table.
>However here is the problem, in ASC order I get these results: $110.46
>And in DESC order I get these results:
>(with the max result 208 for instance at the 3rd from very bottom, 110
>is at very bottom)
Sounds like you want:
ORDER BY ROUND(($varA*(establishments^2)+$varB*(establishments)+$varC),2)
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=1