Posted by Steve on 10/25/05 13:34
> I need to sort some values by percentage, and don't know how... Let MySQL do the work for you: SELECT @TOT:=SUM( `usage` ) FROM mytable and in the same session, calculate all the percentages and return just the first one: SELECT `usage`, `usage` / @TOT AS `perc` FROM mytable ORDER BY `perc` LIMIT 1 No need to learn about arrays just yet 8-) --- Steve
[Reply to this message]
Copyright © 2005-2006 Powered by Custom PHP Programming