Murray @ PlanetThoughtful wrote:
Hi there!
How do I do a sort in PHP where a column in a db must be two other columns
divided...`?
<snip>
Hi Gustav,
You should be able to use the divide operation in your query's ORDER BY
clause.
Eg
SELECT * FROM mytable ORDER BY (field1 / field2)
You might need to do:
SELECT *, (field1 / field2) AS divField FROM mytable ORDER BY divField
as I'm not sure if you can use expressions like that in the ORDER BY
clause. Maybe...
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/
If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php