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 ...

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...