Home >Backend Development >PHP Tutorial >yii中使用ar可以开展嵌套查询吗

yii中使用ar可以开展嵌套查询吗

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:07:45986browse

yii中使用ar可以进行嵌套查询吗?

$c             = new CDbCriteria();<br />$c->join   = "left join (select goods_id, group_concat(name) as `tags` from goods_tag group by goods_id) `tag` on tag.goods_id=t.id";<br />$res = Goods::model()->with( 'brand' )->findAll( $c );


类似上面的查询(上面的不对,查不出 tags字段),yii用ar可以查询吗?具体怎么操作? 
------解决思路----------------------
内嵌查询可以通过:
$sql = '';
$result = Yii::app()->db->createCommand($sql)->query();

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn