Alright, I've finally got table joins figured out, and
I'm now wrestling with a more advanced operation...

Suppose you have a table with four columns. The first
three colums each list a numeral, and the fourth
column lists the sum of those numerals, like this:

3 | 3 | 4 | 10
10 | 10 | 5 | 25

Now, suppose you wanted to also display those numerals
as percentages:

Reds | Blues | Grays | TOTAL
30% | 30% | 40% | 100%
40% | 40% | 20% | 100%

(Actually, I may retain the original numerals in the
last column...)

30% | 30% | 40% | 10
40% | 40% | 20% | 25

I want to give visitors BOTH types of information -
plain numerals and percentages. I'm just trying to
figure out a clever and efficient way of doing it.
Since I already have a table with numerals, I was
hoping there might be a way to convert them to
percentages with MySQL (or PHP).

More specifically, here's a snapshot of my table:

http://www.geoworld.org/percents.gif

Notice the column labeled "Pop" (Population). Each
numeral in that field is the sum of all the numerals
to the right except the last field (Hispanic).

I'd like to include a feature that would allow
visitors to see these numbers as percentages. The
coolest strategy would probably be a simple conversion
- they simply click something or other, and all the
numerals that need to be converted are converted to
percentages.

If that can't be done (or if it's over my head), I
could make a second page with a similar table
featuring percentages. However, it will take me
forever to calculate roughly 25,000 percentages, so it
would still be nice to figure out a way to do it with
MySQL. 

Failing that, I suppose I can always go back to my
spreadsheet and see if I can do it there.

I see some information about "operators" and
multiplication on 
http://dev.mysql.com/doc/mysql/en/Numeric_type_overview.html
but a more user friendly overview would be a great
help. Most of my numeral fields are designated
int(10).

Any tips?

Thanks.



        
                
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to