title: Run complex update query on remote server using OPENROWSET
body: <p>Could you please help me with below task. I need to run below query on remote server</p>
  
  <pre><code>UPDATE prod
      SET prod.count = ( SELECT SUM(Inv) FROM cost WHERE pID = prod.ID)
      WHERE (( SELECT COUNT(id) FROM Cost WHERE pID = prod.ID ) &gt; 0)
  </code></pre>
  
  <p>I have tried to use OPENROWSET but do not have enough experience working with it and all online examples with OPENROWSET that I saw use only one table. Can you please give me an idea how to modify this query to use OPENROWSET or ideas of any other solutions?</p>