title: Out of range value for column '(null)' at row 1
body: <pre><code>UPDATE  monthly_report_c a
         LEFT JOIN
          (
          SELECT  DATE_FORMAT((STR_TO_DATE(a.TRANSACTION_DATE,'%d.%m.%Y')), '%Y%m') mnt, 
          COUNT(DISTINCT a.CUSTOMER_ID) totalNum
          FROM    spendingtx a
          WHERE   a.CARD_PROGRAM = "visa"
     AND  CAST(a.AMOUNT AS DECIMAL(5,2)) &gt; 0.01
          GROUP   BY DATE_FORMAT((STR_TO_DATE(a.TRANSACTION_DATE,'%d.%m.%Y')),'%Y%m')
      ) b ON b.mnt = a.Month_Number
  
  .
  .
  .
  SET a.visa = IFNULL(b.totalNum, 0)
  </code></pre>
  
  <p>The code above extracts from <code>spendingtx</code> table and updates another table which has the first field as <code>yearmonth</code> (i.e. 201309 201310 ... etc) </p>
  
  <p>I'm getting this error:</p>
  
  <blockquote>
    <p>[Err] 1264 - Out of range value for column '(null)' at row 1 </p>
  </blockquote>