微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – Mysql乘法运算

如何在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
    ";

如何在此查询中执行乘法运算?说..乘法运算btw 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 ...

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐