I am trying to update a table filed taking value from another table by summing a field based on EmpID
.
In tblEmpInfo
EmpID
is primary key. I have saw few post on this site but couldn't adopt to my file. Here is my code till yet.
UPDATE tblEmpInfo AS c
INNER JOIN (SELECT EmpID, SUM(ProfidentFund) AS total FROM tblTransactions GROUP BY EmpID) AS x ON c.EmpID = x.EmpID
SET c.ProfidentFund = x.total;
Above code give me following warning and do not update value to tblEmpInfo
tblEmpInfo
screenshot.
tblTransactions
screenshot.
And my expected output.