请问这样的查询,怎样用ar实现?

select distinct ti.processInstance from TaskInstance ti where ti.processInstance.end is null and ti.actorId= :actorId  and ti.isOpen=false order by ti.processInstance.id desc

taskInstance 和processInstance 是model。

processInstance  has-many taskInstance 。

A::model()->with(B)->together()->findAll(…)

distinct 怎么体现出来?

加在select选项里。

不知道怎么添加?

…->findAll(array('select'=>'DISTINCT ti.processInstance'));