我了解 mysql 的基础知识,需要帮助更新查询,其中选择查询是这样的:
SELECT f.FinalAmount,f.ActualAmount,fh.ActualPaid,p.Name package,f.FromDate,f.ToDate
from customers c
join fees f on f.CustomerID = c.ID
join packages p on p.ID=f.PackageID
left join fees_history fh on f.ID = fh.ReferenceID
where c.ID='108239' and c.branch='664'
我想更新 f.FromDate
但知道如何做到这一点,因为 SELECT 语句需要加入查询。
答案 0 :(得分:0)
直接:
UPDATE
customers c
join fees f on f.CustomerID = c.ID
join packages p on p.ID=f.PackageID
left join fees_history fh on f.ID = fh.ReferenceID
SET f.FromDate = ???
where c.ID='108239' and c.branch='664'
附注。 left join fees_history fh on f.ID = fh.ReferenceID
不影响更新,必须删除。