MySQL query count multiple values
        Posted  
        
            by Sqlclown
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sqlclown
        
        
        
        Published on 2010-04-13T18:21:44Z
        Indexed on 
            2010/04/13
            18:23 UTC
        
        
        Read the original article
        Hit count: 407
        
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?
© Stack Overflow or respective owner