how to used IN & Between Clause in YII ACtive Record?

后端 未结 7 1761
轻奢々
轻奢々 2021-02-14 10:15

I want write a Following Query in Active record .

SELECT *
FROM `User`
WHERE `UserId`
IN ( 6, 7, 8, 9 ) ;

Thanks

7条回答
  •  广开言路
    2021-02-14 10:44

    You can use CDbCriteria statement:

    $criteria = new CDbCriteria();
    $criteria->addInCondition('userId', array(6,7,8,9));
    $result = User::model()->findAll($criteria);
    

提交回复
热议问题