--- Roger Baklund <[EMAIL PROTECTED]> wrote: > use test;
Yikes - you lost me on the second word! Are you talking about the sort of "test" that's described on this page?: http://dev.mysql.com/doc/mysql/en/running_mysqltest.html > create table pct (red int,blue int,gray int); > insert into pct values (3,3,4),(10,10,5); OK, you want me to create a table named "pct" and give it files designated int and named red, blue and gray, right? I'll have to do a little more research before I understand the rest, but is this an operation I'll have to perform on every row? Or does it set the table up for an operation that will transfrom all the numerals in selected columns into percentages? I think I basically understand what you're saying; it will just take a little while for it to soak in. Thanks. > select @total:=red+blue+gray as total, > concat(red/(@total/100),"%") as red, > concat(blue/(@total/100),"%") as blue, > concat(gray/(@total/100),"%") as gray > from pct; > > Because of the use of a "user variable" (@total) to > calculate the total in > my example, I have to have the total column first, > because it must be > calculated before the individual percentage > calculations. If you have a > total column in your table, you can use that in the > calculations and place > it in the last column. > > -- > Roger > __________________________________ 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]