I have the following:
id | name | Book Read | Date Read
1 Maria Dogs love cats 12/31/2008
1 Maria Cats and Dogs 12/31/2007
1 Maria Cowboys 12/31/2006
2 Tom Cowboys 12/31/2008
2 Tom Indians 12/31/2005
2 Tom Cats and Dogs 12/31/2003
3 Harry Raining hard 12/31/2005
3 Harry Cats and Dogs 12/31/2002
3 Harry Indians 12/31/2001
If I do “SELECT * FROM table GROUP BY id”, I get:
id | name | Book Read | Date Read
1 Maria Dogs love cats 12/31/2008
2 Tom Cowboys 12/31/2008
3 Harry Raining hard 12/31/2005
But how do I get the first 2 books for each person? i.e.:
id | name | Book Read | Date Read
1 Maria Dogs love cats 12/31/2008
1 Maria Cats and Dogs 12/31/2007
2 Tom Cowboys 12/31/2008
2 Tom Indians 12/31/2005
3 Harry Raining hard 12/31/2005
3 Harry Cats and Dogs 12/31/2002
Supposing you have an autoincrement field, in my example called i
This is another alternative