title: Magento 2: How Insert on Duplicate works in this case?
body: <p>I am using Magento 2.1.7. In my database table, I need to <strong>create a row</strong> / <strong>Update a row</strong> based on ItemNo and GroupNo group.</p>
  <p><img src="https://i.stack.imgur.com/jZZyw.png" alt="Refer to this image to see the example table structure" /></p>
  <p>For example, I need to update the Qty based on ItemNo and GroupNo combination.If the combination doesn't exist, then a new row to be created.</p>
  <p>How is this possible using Insertonduplicate in SQL query?</p>