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

后端 未结 7 1739
轻奢々
轻奢々 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:39

    You can put your array as a value for a specific attribute, like this (no tested):

    $model=new User();
    $result=$model->findAllByAttributes(array('UserId'=>array(6,7,8,9)));
    

提交回复
热议问题