此sql查询未更新数据库,而是返回错误。有什么建议吗?
PreparedStatement ps10 = con.prepareStatement("UPDATE payroll_system.payslip SET hours_worked = (SELECT SUM(Hours) FROM payroll_system.monthly_timesheet WHERE employeeID=?) WHERE employeeID=?");
ps10.setString(1, employee_id);
ps10.setString(2, employee_id);
ps10.executeUpdate();
答案 0 :(得分:0)
试试这个:
UPDATE payroll_system.payslip as t1
SET hours_worked = (SELECT SUM(Hours) FROM payroll_system.monthly_timesheet WHERE employeeID=t1.employeeID)
WHERE employeeID=?