Mysql乘法运算

Coo*_*eze 3 php mysql sql

如何在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
    ";
Run Code Online (Sandbox Code Playgroud)

如何在此查询中执行乘法运算?说..乘法运算btw days_mess和

Pas*_*TIN 10

乘法运算符是*:

mysql> select 100 * 2;
+---------+
| 100 * 2 |
+---------+
|     200 |
+---------+
1 row in set (0.00 sec)
Run Code Online (Sandbox Code Playgroud)


在您的情况下,如果要将两列的值相乘,则可以使用这些列,并*在它们之间使用运算符:

select column1 * column2 as result
from your_table
where ...
Run Code Online (Sandbox Code Playgroud)