title: SQL MERGE using GROUP BY
body: <p>I have to do a <code>MERGE</code> statement but before I need to prepare the query, this query has a <code>group by</code> with some string columns and values, because I'm doing a group by, I can't include the primary key. How can I do my <code>MERGE</code> if I can't provide a primary key?</p>
  
  <p>This is the query</p>
  
  <pre><code>SELECT Account,
         BillDate, 
         Name,
         SUM(ChargeAmount) AS ChargeAmount, 
         SUM(ChargeTaxes) AS ChargeTaxes,       
    FROM MyTempTable
   GROUP BY Account, BillDate, Name
  </code></pre>
  
  <p>Now I need to do a <code>MERGE</code> into my table starting from that query but I don't have a pk.</p>