How about...

mysql> select concat(50/1432, '%') as percentage;
+------------+
| percentage |
+------------+
| 0.03%      |
+------------+
1 row in set (0.00 sec)

mysql> select concat(1324/4.14, '%') as percentage;
+------------+
| percentage |
+------------+
| 319.8068%  |
+------------+
1 row in set (0.01 sec)

mysql> select concat(round(1324/4.14, 2), '%') as percentage;
+------------+
| percentage |
+------------+
| 319.81%    |
+------------+
1 row in set (0.00 sec)

Keep in mind, that this value is now a string.....

-----Original Message-----
From: Atle Veka [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 11:27 AM
To: John Halladay
Cc: MySQL List (E-mail)
Subject: Re: Percent?



couldn't you just do:

SELECT data1 * 100 FROM table;

which if data1 is 0.25, you'd get a result of 25, and depending on what
you're using for the frontend, it would be really easy to add on the
percentage sign....


- Atle

On Thu, 15 Feb 2001, John Halladay wrote:

> I can't find this in the manual (maybe I'm looking in the wrong place).
How
> do I show a value as a percent?  For example.
> 
> SELECT data1, data2, data3 FROM table;
> 
> Assuming data1 is 0.25, how do I show it as 25%?
> 
> SELECT PERC(data1), data2, data3 FROM table;?????
> 
> Thanks.
> 
> John Halladay
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to