* Doug Thompson
> When you repeated the query, the number of significant places was
> reduced by one each time.
> Thus:
> 100.4235
> 100.4230
> 100.4200
> 100.4000

ah.

No, this was a misunderstanding... this is what I did:

mysql> set @a:=8;
Query OK, 0 rows affected (0.00 sec)

mysql> select @a:=digits,round(number,@a) from testme;
+------------+------------------+
| @a:=digits | round(number,@a) |
+------------+------------------+
|          3 |     100.42300000 |
|          1 |      85.40000000 |
+------------+------------------+
2 rows in set (0.00 sec)

mysql> select @a:=digits,round(number,@a) from testme;
+------------+------------------+
| @a:=digits | round(number,@a) |
+------------+------------------+
|          3 |            100.4 |
|          1 |             85.4 |
+------------+------------------+
2 rows in set (0.00 sec)

(and then I repeated the statement two more times, using @b instead of @a,
with first zero and then 1 digit decimals as a result.)

Because the number of decimal digits in the result column is decided at
parse time, and not for each row, the first query return 8 decimals, because
@a was 8 at parse time, and the second return 1 decimal, because @a was 1 at
parse time, from the previous select statement:

mysql> select @a:=digits,round(number,@a) from testme order by number;
+------------+------------------+
| @a:=digits | round(number,@a) |
+------------+------------------+
|          1 |             85.4 |
|          3 |            100.4 |
+------------+------------------+
2 rows in set (0.03 sec)

mysql> select @a:=digits,round(number,@a) from testme order by number;
+------------+------------------+
| @a:=digits | round(number,@a) |
+------------+------------------+
|          1 |           85.400 |
|          3 |          100.423 |
+------------+------------------+
2 rows in set (0.00 sec)

It was a bit confusing... :o)

--
Roger
query


---------------------------------------------------------------------
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