title: How to UPDATE one column based on the MAX DATE from another column MySQL
body: <p>-I am performing an update on a column in my table. However I would like tp perform the UPDATE only on the rows based on the MAX date from another column in that table. As can be seen below usually the Category column needs to be updated whenever the date is the MAX in the DATE column.</p>
  
  <p>For now It is somewhat manual work as I have to explicitly define the date  like in the code below. 
  I would like the code to be something like Update only when DATE IS MAX.</p>
  
  <p>Date format is YYYY-MM-DD </p>
  
  <pre><code>Product Number  Date        category
  A               2018-01-01   x 
  B               2019-01-01   y
  C               2020-01-01   z   
  D               2021-01-01       
  
  
  UPDATE SALES_TOTAL LEFT JOIN Masterdata_MAPEBIAS on SALES_TOTAL.`Product Number` = Masterdata_MAPEBIAS.`Item` and Date = '2021/01/01'
  SET
  SALES_TOTAL.`Category` = Masterdata_MAPEBIAS.Category;
  </code></pre>