MySQL: 遞增排序重複的數字
<p>我有一個表格,看起來像這樣:</p>
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>values</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>1</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
</tr>
<tr>
<td>4</td>
<td>2</td>
</tr>
<tr>
<td>5</td>
<td>2</td>
</tr>
<tr>
<td>6</td>
<td>2</td>
</tr>
</tbody>
</table>
<p>我想要在某種循環中按照這種方式對它們進行遞增排序。 </p>
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>values</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>4</td>
<td>2</td>
</tr>
<tr>
<td>2</td>
<td>1</td>
</tr>
<tr>
<td>5</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
</tr>
<tr>
<td>6</td>
<td>2</td>
</tr>
</tbody>
</table>
<p>我相信這可以很容易地用PHP完成,但是我想看看是否可以使用SQL來實現。 </p>