sftdev
sftdev

Reputation: 1701

Yii CDbCriteria- Query using IN

What is the equivalent CDbCriteria method or properties if i want to query this way

select * from tbl_data where id in(2,3,6,8)

Im not sure as to which property to use though.

Thanks in advance

Upvotes: 0

Views: 92

Answers (1)

naveen goyal
naveen goyal

Reputation: 4629

Try This

$condInArr = array(2,3,6,8);
$Criteria = new CDbCriteria();
$Criteria->addInCondition('id', $condInArr);
$List = TblData::model()->findAll($Criteria);

Upvotes: 2

Related Questions