I want to select 3 record from each group by mysql query my table structure is like this -
id | customer | catId
---------------------
 1 | Joe      | 2
 2 | Sally    | 2
 3 | Joe      | 2
 4 | Sally    | 2
 5 | Joe      | 2
 6 | Sally    | 3
 7 | Joe      | 3
 8 | Sally    | 3
 9 | Joe      | 3
10 | Sally    | 4
11 | Joe      | 4
12 | Sally    | 4
I want to select 3 records for each distinct catId means
id | customer | catId
---------------------
 1 | Joe      | 2
 2 | Sally    | 2
 3 | Joe      | 2
 6 | Sally    | 3
 7 | Joe      | 3
 8 | Sally    | 3
10 | Sally    | 4
11 | Joe      | 4
12 | Sally    | 4
I tried this query but its showing only one record for each distinct catId. l
SELECT * FROM
tableGROUP BY CatIds
and I am getting
id | customer | catId
---------------------
 1 | Joe      | 2
 6 | Sally    | 3
10 | Sally    | 4