【发布时间】:2018-04-13 06:24:41
【问题描述】:
我正在处理yii2。我正在使用活动记录来搜索参考号。查询如下
$q = isset($_GET['q']) ? $_GET['q'] : '';
if(empty($q)) exit;
$ser = Survey::find()->where("ref_no like '%$q%'")->andWhere(['status'=>1])->asArray()->all();
return json_encode($ser);
上述查询将获得调查表中的所有参考编号。现在我想添加一个NOT IN 条件。原始查询如下
...... where ref_no LIKE '%$q%' NOT IN (select ref_no from installations where ref_no LIKE '%q%')
如何将其添加到我的活动记录查询中?
任何帮助将不胜感激。
【问题讨论】:
标签: activerecord yii2 yii2-advanced-app notin