title: How to Update if the data exist else insert the new data (multiple rows)
body: <p>I need to create a insert and update statement, when today date is not in the database it will insert else it will update the QTY (from excel [this part I have done]) get from today.</p>
  
  <p>But, there have a lots of row need to be insert and update.</p>
  
  <p>1) it will check for the last 4 days in database, if there doesn't include today, it will just insert the data for today and update the last 3 days data. in the other hand, if there contain today it will just update.</p>
  
  <p>P.S: I had try to use <code>INSERT... ON DUPLICATE KEY UPDATE</code> but it only 1 row affected. </p>
  
  <p>If else statement , when i used this it only insert one row of data then the rest it just doing update.</p>
  
  <p>Can give me some advise or example.</p>