title: Trying to resolve a syntax error for MYSQL update trigger
body: <p>I am trying to create a trigger to update the <code>Project</code> table whenever the <code>Assign</code> table is updated, yet I keep receiving this error:  <code>You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'END IF</code></p>
  <p>Does anyone have any idea of why I am getting this syntax error?  Please note that I am a beginner at this so my SQL statements may be entirely wrong. Also, I know for sure that my query being ran in my IF statement works because I've ran it on its own without being inside a trigger.</p>
  <pre><code>delimiter $$
  
  CREATE TRIGGER update_trigger AFTER UPDATE ON Assign
  FOR EACH ROW
    BEGIN
      IF OLD.projNo &lt;&gt; new.projNo THEN
      
      #RUN THIS QUERY TO UPDATE MY TABLE
  
      
          UPDATE Project p JOIN 
            (SELECT Project.projNo, COUNT(DISTINCT empid) as numEmployeeAssigned
              FROM (Project LEFT JOIN Assign ON Project.projNo=Assign.projNo) 
              GROUP BY projNo
              ) as tb 
              ON p.projNo = tb.projNo
              SET p.numEmployeeAssigned = tb.numEmployeeAssigned
              
       #END QUERY
       
      END IF
    END$$
  delimiter;
  </code></pre>