title: Update one table based on values in another table using case statement (MYSQL)
body: <p>I am trying to run the below query to update a table based on values in another table using case statement. And i get the following error.</p>
  
  <pre><code>Error Code: 1064
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from tbl_a as a, tbl_b as b
    WHERE a.DIV_NO = b.' at line 12
  </code></pre>
  
  <p>Here is the query:</p>
  
  <pre><code>UPDATE a
    SET
      a.MIN_5 = b.Min_Five,
      a.IN_PR = b.Ad_Flag ,
      a.FRC = (
                      CASE
                         WHEN b.Prc_Fl = 'N' THEN 'Y'
                         WHEN b.Prc_Fl = 'Y' THEN 'N'
                         ELSE 'D'
                      END
              )
    FROM tbl_a AS a, tbl_b AS b
    WHERE a.DIV_NO = b.Div_num
      AND a.OFR_ID = b.Flg ;
  </code></pre>