对于登录用户使用统计/关系查询发布的每个请求,我需要显示最大速率和最小提案速率以及提案计数。我正在使用关系获得计数或最低比率
public function relations()
{
return array('serviceproposals'=>
array(self::HAS_MANY,'Serviceproposal','ServiceRequestID'),
'user' => array(self::BELONGS_TO, 'Buyer', 'user_id'),
'postCount'=>array(self::STAT,'serviceproposal', 'ServiceRequestID','select'=>'MAX(proposal_rate)'),
);
}
使用的数据库包含:-
User[user_id,name,password],
Provider[user_id,providercompany,providerdetails],
Buyer[user_id,contactinfo],
ServiceRequest[ServiceRequestID,Buyer.user_id,details,date],
ServiceProposal[ServiceProposalId,ServiceRequestID,Provider.user_id,services,propsal_rate]
提前致谢..