title: How to select only first ROW_NUMBER combined with SUM
body: <p>I like to group my table by [ID] while using SUM and also bring back 
  [Product_Name] of the top <code>ROW_NUMBER</code> - not sure if I should use <code>ROW_NUMBER</code>, <code>GROUPING SETS</code> or loop through everything with FETCH... this is what I tried:</p>
  
  <pre><code>DECLARE @SampleTable TABLE 
                       (
                            [ID] INT, 
                            [Price] MONEY, 
                            [Product_Name] VARCHAR(50)
                       )
  
  INSERT INTO @SampleTable 
  VALUES (1, 100, 'Product_1'), (1, 200, 'Product_2'),
         (1, 300, 'Product_3'), (2, 500, 'Product_4'),
         (2, 200, 'Product_5'), (2, 300, 'Product_6');
  
  SELECT
      [ID],
      [Product_Name],
      [Price],
      SUM([Price]) OVER (PARTITION BY [ID]) AS [Price_Total],
      ROW_NUMBER() OVER (PARTITION BY [ID] ORDER BY [ID]) AS [Row_Number]
  FROM
      @SampleTable T1
  </code></pre>
  
  <p>My desired results - only two records:</p>
  
  <pre><code>1   Product_1   100.00   600.00     1
  2   Product_4   500.00  1000.00     1
  </code></pre>
  
  <p>Any help or guidance is highly appreciated.</p>
  
  <p><strong>UPDATE:</strong>
  I end up using what Prateek Sharma suggested in his comment, to simply wrap the query with another SELECT WHERE [Row_Number] = 1</p>
  
  <pre><code>SELECT * FROM
  (
      SELECT
          [ID]
          ,[Product_Name]
          ,[Price]
          ,SUM([Price]) OVER (PARTITION BY [ID]) AS [Price_Total]
          ,ROW_NUMBER() OVER (PARTITION BY [ID] ORDER BY [ID]) AS [Row_Number]
      FROM @SampleTable
  ) MultipleRows
  WHERE [Row_Number] = 1
  </code></pre>