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

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

    I still using this way:

    public function getInterval( $data_start, $data_stop ){
      $criteria = new CDbCriteria;
      $criteria->condition = "date  >= '$data_start' AND date <= '$data_stop'";
      return $criteria;
    }
    $model = Object::model()->findAll(getInterval('2014-06-01','2014-06-30');
    

提交回复
热议问题