[求助]在mysql中如何实现除运算?
请问在mysql数据库如何实现数据之间关系的除法运算?
怎样用sql语句来实现?
谢谢!
如果是单纯的把MYSQL作为计算器直接用select就可以了
mysql> select 1+2;
+-----+
| 1+2 |
+-----+
| 3 |
+-----+
1 row in set (0.00 sec)
mysql> select 8/4;
+--------+
| 8/4 |
+--------+
| 2.0000 |
+--------+
1 row in set (0.01 sec)
如果是数据表里面列与列之间的可以这样:
SELECT `row1`,`row2`,(row2-row1) as result FROM `num`
[此贴子已经被作者于2007-4-5 17:22:50编辑过]