title: How to update every other row from select query?
body: <p>I have a SQL query that pulls 160 records from a table in my database.</p>
  
  <pre><code>SELECT TableID, Number, Active FROM Table WHERE Number IN (SELECT Number 
  FROM Table
  GROUP BY Number, Active
  HAVING COUNT(*) &gt; 1 AND COUNT(*) &lt; 3
  AND Active = 1)
  ORDER BY Number, TableID
  </code></pre>
  
  <p>What I am trying to do is update the Active flag to 0 in every other row of this query.  Something along the lines of:</p>
  
  <pre><code>UPDATE Table SET Active = 0 where Number in (
  SELECT TableID, Number, Active FROM Table WHERE Number IN (SELECT Number 
  FROM Table
  GROUP BY Number, Active
  HAVING COUNT(*) &gt; 1 AND COUNT(*) &lt; 3
  AND Active = 1 AND Number %2 = 1) -- this is where I need assistance
  ORDER BY Number, TableID)
  </code></pre>
  
  <p>How do I execute this query successfully?  The similar questions are not providing the answers I am looking for.</p>
  
  <p>EDIT: Here is the sample shortened data set from the top query:</p>
  
  <pre><code>TableID Number  Active
  38      662         1
  177     662         1
  58      702         1
  171     702         1
  13      716         1
  165     716         1
  77      814         1
  164     814         1
  63      1103        1
  174     1103        1
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>TableID Number  Active
      38      662         1
      177     662         0
      58      702         1
      171     702         0
      13      716         1
      165     716         0
      77      814         1
      164     814         0
      63      1103        1
      174     1103        0
  </code></pre>