I have video model and album model, Like,
| video | title | album_id |
| ----- | --------- | -------- |
| 1 | apple A 1 | 1 |
| 2 | apple A 2 | 1 |
| 3 | apple A 3 | 1 |
| 4 | apple A 4 | 1 |
| 5 | apple A 5 | 1 |
| 6 | apple B 6 | 2 |
| 7 | apple B 7 | 2 |
| 8 | apple B 8 | 2 |
| 9 | apple B 9 | 2 |
Now I have to query videos with a limit that I should return at most 2 videos for each album. Like when I search apple
, I need to get [apple A 1, Apple A 2, Apple B 6, Apple B 7]
. Is there any way to do this?