[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
data types for calculated columns
Hi,
Here is how to reproduce my problem.
1> create table t1(a bigint);
2> insert into t1(a) values(2);
3> create table t2(b double);
4> insert into t2(b) values(3);
5> select t1.a/t2.b as c from t1,t2;
+------------------+
| c |
+------------------+
| 0.66666666666667 |
+------------------+
6> create table t3 select t1.a/t2.b as c from t1,t2;
7> select format(c,16) from t3;
+------------------+
| format(c,16) |
+------------------+
| 0.70000000000000 |
+------------------+
Now you see 2/3 becomes 0.7. How can I keep the double precission here?
thanks
Larry Weng
---------------------------------------------------------------------
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 <mysql-thread92378@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
This mailing list archive is a service of Copilot Consulting.