I have a simple table looking like this :
USER_NAME STATUS
------------------
Paul 1
John 4
Brad 1
Simon 1
Jack 4
I have 10 different status and around 2000 rows (users).
I want to export a small sample of rows from each status from my production database. Then I will import them in my dev database to run tests
I want a query that select a few (let's say 3) rows for each value of the status
field
- 3 users with status 1
- 3 users with status 2
- 3 users with status 3
- ...
How could I achieve that ? Do i have to do a loop on STATUS and use LIMIT ?
Thanks a lot !
EDIT : edited for clarity