->from('unitlistings ul, images imgs')
->where("ul.refno = imgs.refno AND ul.district = 'Dubai Marina' AND ul.sellprice > '0' AND ul.bedrooms > '0' AND ul.status = 'available'")
->limit(4)
->order('rand()')
->queryall();
When I load my index file I get this error: CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table ‘unitlistings’…
But this works fine
$marina = UnitListings::model()->findAll(array(‘condition’=>“district = ‘Dubai Marina’ AND sellprice > ‘0’ AND bedrooms > ‘0’ AND status = ‘available’”, ‘limit’ => ‘4’, ‘order’ => ‘rand()’));
on the first line you wrote select(‘unitlistings.,…’) but then you gave it an alias as “ul”… so change the first line to select('ul.,…’)… same for the other table…