title: select statement
body: <p>my table looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/HxvUR.jpg" alt="enter image description here"></p>
  
  <p>If the field name contains cost or quantity for the same lineItemIds, I have to display the result as:</p>
  
  <blockquote>
    <p>cost is changed from 8*1=8
    (fromVal*fromVal) to 9*6=54
    (toVal*toVal) for itemID 123.</p>
  </blockquote>
  
  <p>any help will be appreciated.</p>