更新时间:2023-12-01 10:57:40
只需将 rentday
与 days
相乘即可得到计算值 totalrent
选择
列表.
Just multiply rentday
with days
to get the computed value totalrent
in Select
list.
尝试一下
SELECT customers.*, -- Not sure this is allowed in [Mysql]
cardetail.carname,
cardetail.model,
cardetail.company,
cardetail.color,
cardetail.rentday,
rentorder.days,
cardetail.rentday * rentorder.days AS totalrent
FROM rentorder
INNER JOIN customers
ON customers.custid = rentorder.custid
INNER JOIN cardetail
ON cardetail.id = rentorder.carid
要保存数据,您需要使用内部联接
语法
To save the data you need to use update
from Inner Join
syntax
update rentorder
INNER JOIN customers
ON customers.custid = rentorder.custid
INNER JOIN cardetail
ON cardetail.id = rentorder.carid
SET
rentorder.totalrent = cardetail.rentday * rentorder.days