我有一个查询,它为我提供了许多对context_id和class_id。我想通过另一个查询来满足其中一个问题。所以我需要去哪里(co1和cl1)或者(co2和cl2)或者.
这个给了我一系列和‘s:
foreach($tscarr as $tsc)
{
$grid->dq->where('context_id',$tsc['context_id'])->where('class_id',$tsc['class_id']);
}我从这个页面上知道:http://agiletoolkit.org/doc/dsql/where是我应该能够做的或者。但当我试图使用或以这种方式使用时,我会遇到一个错误:
$grid->dq->where($grid->dq->or()->where($grid->dq->where('context_id',$tsc['context_id'])->where('class_id',$tsc['class_id'])));希望你有个好主意怎么解决这个问题..。
发布于 2014-02-20 23:56:28
您可以使用$dsql->orExpr()方法。
在Stackoverflow中有多个例子,比如这个https://stackoverflow.com/a/17958175/1466341和ATK4中的groups,在这里,https://groups.google.com/forum/#!forum/agile-toolkit-devel只是搜索orExpr。
我想,在你的例子中,类似的东西应该能起作用(未经测试):
$q = $grid->dq;
$or = $q->orExpr();
foreach($tscarr as $tsc)
{
$or->where(
$q->andExpr()
->where('context_id', $tsc['context_id'])
->where('class_id', $tsc['class_id'])
);
}
$q->where($or);https://stackoverflow.com/questions/21918395
复制相似问题