跳到主要内容
版本: 最新版本-3.5

multiply

计算参数的乘积。

语法

multiply(arg1, arg2)

参数

arg1:数值源列或字面值。arg2:数值源列或字面值。

返回值

返回两个参数的乘积。返回类型取决于参数。

使用说明

如果指定非数值,则此函数将失败。

示例

MySQL [test]> select multiply(10,2);
+-----------------+
| multiply(10, 2) |
+-----------------+
| 20 |
+-----------------+
1 row in set (0.01 sec)

MySQL [test]> select multiply(1,2.1);
+------------------+
| multiply(1, 2.1) |
+------------------+
| 2.1 |
+------------------+
1 row in set (0.01 sec)

MySQL [test]> select * from t;
+------+------+------+------+
| id | name | job1 | job2 |
+------+------+------+------+
| 2 | 2 | 2 | 2 |
+------+------+------+------+
1 row in set (0.08 sec)

MySQL [test]> select multiply(1.0,id) from t;
+-------------------+
| multiply(1.0, id) |
+-------------------+
| 2 |
+-------------------+
1 row in set (0.01 sec)

关键词

multiply