title: Select newest records that have distinct Name column
body: <p>I did search around and I found this
  <a href="https://stackoverflow.com/questions/189213/sql-selecting-rows-by-most-recent-date">SQL selecting rows by most recent date with two unique columns</a>
  Which is so close to what I want but I can't seem to make it work.</p>
  <p>I get an error Column 'ID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.</p>
  <p>I want the newest row by date for each Distinct Name</p>
  <pre><code>Select ID,Name,Price,Date
  From  table
  Group By Name
  Order By Date ASC
  </code></pre>
  <p>Here is an example of what I want</p>
  <p>Table</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Name</th>
  <th>Price</th>
  <th>Date</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>0</td>
  <td>A</td>
  <td>10</td>
  <td>2012-05-03</td>
  </tr>
  <tr>
  <td>1</td>
  <td>B</td>
  <td>9</td>
  <td>2012-05-02</td>
  </tr>
  <tr>
  <td>2</td>
  <td>A</td>
  <td>8</td>
  <td>2012-05-04</td>
  </tr>
  <tr>
  <td>3</td>
  <td>C</td>
  <td>10</td>
  <td>2012-05-03</td>
  </tr>
  <tr>
  <td>4</td>
  <td>B</td>
  <td>8</td>
  <td>2012-05-01</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>desired result</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Name</th>
  <th>Price</th>
  <th>Date</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2</td>
  <td>A</td>
  <td>8</td>
  <td>2012-05-04</td>
  </tr>
  <tr>
  <td>3</td>
  <td>C</td>
  <td>10</td>
  <td>2012-05-03</td>
  </tr>
  <tr>
  <td>1</td>
  <td>B</td>
  <td>9</td>
  <td>2012-05-02</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I am using Microsoft SQL Server 2008</p>