The table below represents the data I have in a table.
+----+------+
| ID | Year |
+----+------+
|  1 | 2005 |
|  1 | 2006 |
|  2 | 2005 |
|  2 | 2007 |
|  2 | 2008 |
|  3 | 2005 |
|  4 | 2009 |
+----+------+
I want to write a query which will show the results below.
+----+----+------+
| ID |auto| Year |
+----+----+------+
|  1 |  1 | 2005 |
|  1 |  2 | 2006 |
|  2 |  1 | 2005 |
|  2 |  2 | 2007 |
|  2 |  3 | 2008 |
|  3 |  1 | 2005 |
|  4 |  1 | 2009 |
+----+----+------+
As you can see the auto field will display an increment auto numbering to each ID.
 
     
     
     
    