$c = new CDbCriteria();$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";$res = Goods::model()->with( 'brand' )->findAll( $c );
relation里面有写规则不? 先看下CActiveRecord源码 实在不行直接用sql吧
还是使用 createCommand() 比较简单。