Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们有一个名为emp_details列的表CL,PL其中存储了员工的详细信息和加入日期。
emp_details
CL
PL
我需要使用以下规则更新每个员工的 CL 和 PL:
(Current date-Date Of Joining) > 10 然后 CL +=0.5 和 PL +=0.5 的差异
谁能帮我查询MySQL
假设您具有以下结构
UPDATE hs_hr_employee AS l INNER JOIN hs_hr_employee AS r ON l.employee_id = r.employee_id SET l.CL = (r.cl + 0.5), l.PL = (r.pl + 0.5) WHERE (DATE(NOW()) - DATE(l.joined_date)) > 10