如何在 Mysql 查询中执行乘法运算?
如果我的查询是这样的:
"SELECT registration.hosteladmissionno,
registration.student_name,
registration.semester,
student_month.hosteladmissionno,
student_month.student_name,
student_month.semester,
messexp.billmonth,messexp.billyear ,messexp.perdayrate,student_month.days_mess
FROM registration,
student_month ,messexp,blockexp
WHERE student_month.hosteladmissionno = registration.hosteladmissionno
";
如何在此查询中执行乘法运算?说..乘法运算顺便说一句 days_mess 和
最佳答案
乘法运算符是*
:
mysql> select 100 * 2;
+---------+
| 100 * 2 |
+---------+
| 200 |
+---------+
1 row in set (0.00 sec)
在你的情况下,如果你想将两列的值相乘,你可以使用这些列,它们之间有 *
运算符:
select column1 * column2 as result
from your_table
where ...
关于php - Mysql乘法运算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5374001/