title: Sum with SQL server RollUP - but only last summary?
body: <p>I have this query: </p>
  
  <pre><code>DECLARE @t TABLE(NAME NVARCHAR(MAX),datee date,val money)
  
  insert INTO @t SELECT 'a','2012-01-02',100
  insert INTO @t SELECT 'a','2012-01-02',100
  insert INTO @t SELECT 'a','2012-01-03',100
  insert INTO @t SELECT 'a','2012-01-05',100
  insert INTO @t SELECT 'b','2012-01-06',200
  insert INTO @t SELECT 'b','2012-01-07',200
  insert INTO @t SELECT 'd','2012-01-07',400
  insert INTO @t SELECT 'e','2012-01-09',500
  insert INTO @t SELECT 'f','2012-01-12',600
  
  SELECT  Name,datee,SUM (val) 
  from @t GROUP BY NAME ,datee 
  </code></pre>
  
  <p>currently the result is: </p>
  
  <p><img src="https://i.stack.imgur.com/EAsVp.jpg" alt="enter image description here"></p>
  
  <p>BUT I need to add <code>sum</code> at the end.
  So I tried with rollup: </p>
  
  <pre><code> SELECT  Name,datee,SUM (val) 
      from @t GROUP BY NAME ,datee  with ROLLUP
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Zg6EG.jpg" alt="enter image description here"></p>
  
  <p>BUT I only need the <em>last</em> sum total line.  I don't need the <em>in-report</em> <code>sum's</code></p>
  
  <p>So how can get the desire result?</p>
  
  <p>(I cant change the  <code>group by</code> clause  cause others need it also , I just want to add sum at the end with/without rollup).</p>
  
  <p><a href="https://data.stackexchange.com/stackoverflow/query/edit/93333" rel="noreferrer">sql online is here</a> </p>