mysql meeting multiple conditions

Posted by Djeux on Stack Overflow See other posts from Stack Overflow or by Djeux
Published on 2012-08-31T09:36:05Z Indexed on 2012/08/31 9:38 UTC
Read the original article Hit count: 183

Filed under:
|
|

I'm having a table, where one ID, can have multiple statuses

| client_id | status_id |
|     1     |     2     |
|     1     |     3     |
|     1     |     5     |
|     2     |     2     |
|     2     |     3     |
|     2     |     6     |

The problem is, to select only those client_id's if they have all the statuses i.e. 2,3,5 (status_id = 2 AND status_id = 3 AND status_id = 5) but mysql doesn't allow that directly.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about multiple