Hello,
Given table
| id | user |
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 1 | 4 |
| 2 | 5 |
| 2 | 6 |
| 2 | 7 |
| 2 | 8 |
I want to write a query that will return 3 rows for id=1 and 3 rows for id=2 (order does not matter, yet I would assume that it can be enforced).
So the end result should be something like (Note, 3 rows for each id):
| id | user |
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 5 |
| 2 | 7 |
| 2 | 8 |
How should I write this SQL? My attempts with HAVING have not brought something useful so far.
Thank you, Maxim.