join query with customer table, and group by and having clauses not working, its show an error , filed is not found.
The Query
$collection = $this->getCollection();
$collection->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToSelect('latitude')->addAttributeToSelect('free_consult')->addAttributeToSelect('longitude')->addAttributeToFilter('group_id',Federallawyer_Customer_Helper_Data::LAWYER);
$collection->getSelect()->join(array('review'=>'flrating'),"e.entity_id = review.reviewed_user_id ",array('avg_rating'=>'AVG(review.avg_rating)'));
$collection->getSelect()->group('review.reviewed_user_id');
$collection->getSelect()->having('avg_rating > ?', $min)
Best Answer
Maybe because this is a calculated field, did you try this for your having clause? :