MySQL query count multiple values
- by Sqlclown
Consider the following DB table:
c p
=========
1 'a'
1 'b'
2 'a'
2 'c'
Now, my goal is to retrieve a list of numbers c, for which holds that each number in this list has at least a record with p='a' AND p='b'.
In the example table above, that would be c=1.
Now my question is, how do I accomplish this using one MySQL query?