```

id  || week_id || user_id || catch_id(0,1,2)
1   || 2       || 6       || 0
1   || 3       || 6       || 1
1   || 4       || 6       || 1
1   || 5       || 6       || 1
1   || 6       || 6       || 0
1   || 7       || 6       || 0
1   || 8       || 6       || 2
1   || 9       || 6       || 0
1   || 10      || 6       || 0
1   || 11      || 6       || 1

```

I need find out the max consecutive week the **`catch = 1`** and max consecutive week the **`catch = 0`** for each user *(find all)*. I hope i make myself clear. 

In the above table 

max consecutive catch = 1 for user 6 is **3**(weeks 3,4,5)

max consecutive weeks catch = 0 for user 6 is **2**(week 6,7 and/or week 9,10)

How do i go about. Can i do this in purely sql. A php solution is also welcome