I have a table like this:
columns:
id | parent
records:
1 | 1
2 | 1
3 | 1
4 | 2
5 | 2
6 | 2
7 | 3
8 | 4
9 | 5
And for all parents, I want to get the first 2 records, so i should have:
1 | 1
2 | 1
4 | 2
5 | 2
7 | 3
8 | 4
9 | 5
How can I acheive this in MySQL? I need to use subqueries? Thanks.