Mysql Select problem.

I have two tables:

Locations and Sales.

Locations HAS_MANY Sales, and Sales BELONGS_TO Locations

	public function getFiveLocationsBySales()


		return Locations::model()->findall(


			'select'=>',, (SELECT `name` FROM `owners` WHERE id = t.owner) AS owner ,(SELECT sales.sales FROM sales WHERE location = ORDER BY date DESC LIMIT 1) AS sale',

			'order'=>'sale DESC',





<?php $locations = $this->getFiveLocationsBySales(); ?>



     <tr class="listHead">


        <td>Location Name</td>





    foreach($locations as $location)



        <tr class="listRow">

        <td><?php echo $location->owner; ?></td>

        <td><?php echo $location->name; ?></td>

        <td><?php echo $location->sale; ?></td>

        <td><?php echo CHtml::link('View Details',array('franchisees/view/location','id'=>$location->id)); ?></td>






I am getting this error:

Property "" is not defined.

Your Locations active record class does not have a property “sale”; it only has “sale_id”. I’m not sure if adding “sale” as a property will solve this issue; can you let me know if it does? I’m always interested in how to best handle ad hoc queries with Yii.