I want write a Following Query in Active record .
SELECT *
FROM `User`
WHERE `UserId`
IN ( 6, 7, 8, 9 ) ;
Thanks
How to Use In. The function of in as a preposition is to indicate something is inside something else or, more abstractly, to measure time. It is used when you want to indicate a position within a general space.
In general, in is used to indicate location or position within or inside something: We went for a swim in the lake. They have a house in the country. Albuquerque is in New Mexico.
You can use CDbCriteria
statement:
$criteria = new CDbCriteria();
$criteria->addInCondition('userId', array(6,7,8,9));
$result = User::model()->findAll($criteria);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With