title: SQL Updating Values of Column for Each Unique Value in Separate Column (without a loop)
body: <p>I'm currently writing a query that is grabbing data from a table and I want to update one of the columns in that table.  The update needs to be based off the distinct values from one column.  For example:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Type</th>
  <th>ID</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>x</td>
  <td>ID1</td>
  </tr>
  <tr>
  <td>x</td>
  <td>ID1</td>
  </tr>
  <tr>
  <td>y</td>
  <td>ID2</td>
  </tr>
  <tr>
  <td>y</td>
  <td>ID2</td>
  </tr>
  <tr>
  <td>z</td>
  <td>ID3</td>
  </tr>
  <tr>
  <td>z</td>
  <td>ID3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The catch here is that I can't use a loop to do it.</p>
  <p>The table has a lot more columns but I'm only sorting it by &quot;Type&quot; and then updating that table and assigning a unique ID based off its &quot;Type&quot;</p>
  <p>Any ideas on how to do this?</p>