On Sun, 18 Dec 2005, mos wrote:
> How do I square a number in MySQL 4.1? I thought it would be something simple
> like:
>
> select 3**2
>
> but that produces a syntax error. I can use Pow(3,2) but that produces a
> float. Is there a Square function? TIA
mysql> select floor(pow(3,2));
+-----------------+
| floor(pow(3,2)) |
+-----------------+
| 9 |
+-----------------+
1 row in set (0.00 sec)
You might also need round instead of floor depending on whether
the result of pow falls on the low side of the correct result.
>
> Mike
I'm disappointed by the responses that failed to recognise this as
the simplest specification for a more complicated case.
Hugh
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]