At 12:14 -0500 4/29/04, Yoed Anis wrote:
I'm having trouble with this query:
SELECT
CONCAT('$',ROUND(($varA*(establishments^2)+$varB*(establishments)+$varC),2))
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
$173.86
$208.02
$22.62
$22.62

And in DESC order I get these results:
$90.44
$79.94
$50.10
$48.33
(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/[EMAIL PROTECTED]



Reply via email to