title: SQL Server 2008 R2: ROW_NUMBER() with 2 columns
body: <p>Table structure:</p>
  
  <pre><code>CREATE TABLE AZTool
  (
      t_ID int,
      z_ID int,
      col_date date
  );
  </code></pre>
  
  <p>Insert data:</p>
  
  <pre><code>INSERT INTO AZTool values(12,23409,'2017-01-02')
  INSERT INTO AZTool values(12,23409,'2017-01-03')
  INSERT INTO AZTool values(21,23409,'2017-03-14')
  INSERT INTO AZTool values(12,24455,'2017-04-22')
  INSERT INTO AZTool values(22,24455,'2017-05-13')
  INSERT INTO AZTool values(22,35600,'2017-04-04')
  INSERT INTO AZTool values(23,35600,'2017-05-14')
  INSERT INTO AZTool values(24,35600,'2017-05-16')
  INSERT INTO AZTool values(25,35600,'2017-05-24')
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>t_ID    z_ID    RowNumber
  -------------------------
  12      23409   1
  12      23409   1
  21      23409   2
  12      24455   1
  22      24455   2
  22      35600   1
  23      35600   2
  24      35600   3
  25      35600   4
  </code></pre>
  
  <p>My attempt:</p>
  
  <pre><code>SELECT
      t_ID, z_ID,
      ROW_NUMBER() OVER (PARTITION BY t_ID, z_ID ORDER BY z_ID) rn
  FROM 
      AZTool
  </code></pre>