title: How to change a field value to NULL when there is a change in another field using mysql
body: <p>I am a newbie to mysql. Can anyone please help me to sort out this problem,</p>
  
  <p>"I have the following columns emp id,name,leaveto,leavefrom and status in my table. If an employee applies for leave his manager can accept or reject it. If the manager has accepted the leave then the status filed will contain the value as Approved (same for rejected). What I wanted to know is when the employee applies for leave for the second time the leaveto and leavefrom column gets updated but the status field remains the same. "</p>
  
  <p>Is it possible to make the status field to NULL when there is an update in leaveto and leavefrom columns.</p>
  
  <p>This will update the status field (approve/reject) of an employee by comparing his ID and manager ID. If that employee comes under manager "A" then only manager "A" can approve/reject it.</p>
  
  <pre><code>"UPDATE leave_details join managerlogin on managerlogin.manager_id=leave_details.manager_id SET leave_details.leave_status='Approved' where (employee_id='$myemployee_id' and managerlogin.manager_id= '".$_SESSION['mymanager_id']."' )";
  </code></pre>