IN 절의 모든 값 일치

IN` 절의 모든 값이 일치하는지 확인하는 방법이 있나요?

예시입니다:

IN을 다음과 같이 사용할 수 있습니다: in (5,6,7,8).

여러 행에 걸쳐 AND처럼 작동해야 합니다.

업데이트: 지정된 매개 변수에 맞는 DB에서 회사를 나열하려면이 기능이 필요합니다. 회사와 분류는 다대다 관계입니다. 저는 Yii 프레임워크를 사용하고 있습니다. 그리고 이것은 제 컨트롤러의 코드입니다:

public function actionFilters($list)
{
    $companies = new CActiveDataProvider('Company', array(
        'criteria' => array(
            'condition'=> 'type=0',
            'together' => true,
            'order'=> 'rating DESC',
            'with'=>array(
            'taxonomy'=>array(
                'condition'=>'term_id IN ('.$list.')',
                )
            ),
        ),
    ));
    $this->render('index', array(
        'companies'=>$companies,
    ));
}
질문에 대한 의견 (8)
해결책

이렇게 할 수 있습니다:


select ItemID
from ItemCategory
where CategoryID in (5,6,7,8) 
group by ItemID
having count(distinct CategoryID) = 4 
해설 (12)
 SELECT ItemID
     FROM ItemCategory
        WHERE (
               (CategoryID = 5) OR 
               (CategoryID = 6) OR 
               (CategoryID = 7) OR 
               (CategoryID = 8)
              )
     GROUP BY ItemID
 HAVING COUNT(DISTINCT CategoryID) = 4
해설 (2)