Possible Duplicate:
How do I select a fixed number of rows for each group?
For example... if I have this table (sorted by color):
--------------
| id | color |
--------------
| 95 | red |
| 7 | red |
| 44 | red |
| 46 | red |
| 49 | red |
| 24 | green |
| 37 | green |
| 91 | green |
| 88 | green |
| 44 | blue |
| 10 | blue |
| 11 | blue |
--------------
Is there a way for me to get the 2 rows from each color? Example:
--------------
| id | color |
--------------
| 7 | red |
| 44 | red |
| 24 | green |
| 37 | green |
| 10 | blue |
| 11 | blue |
--------------