sql group()与count() 一起用
$count = $this->alias('a')
->join('ls_retail_bill_order as b on a.bill_id=b.id')
->where(array('a.advance_id'=>$parameter['id'],'a.state'=>array('neq',0),'b.order_type'=>1))
->count('distinct(a.uid)');
关键词 DISTINCT 用于返回唯一不同的值
SELECT DISTINCT 列名称 FROM 表名称
distnct用法