I have 2 table
CREATE TABLE IF NOT EXISTS listings (
ListingId int(11) NOT NULL AUTO_INCREMENT,
Title varchar(255) NOT NULL,
ZoneId int(11) NOT NULL,
CityId int(11) NOT NULL,
PRIMARY KEY (ListingId),
KEY ZoneId (ZoneId,CityId),
KEY CityId (CityId)
)
CREATE TABLE IF NOT EXISTS zones (
ZoneId int(11) NOT NULL AUTO_INCREMENT,
Zone varchar(45) NOT NULL,
PRIMARY KEY (ZoneId)
)
i want get zones related with listings
SELECT * FROM listings l LEFT JOIN zones z ON l.zoneid = z.zoneid
This is my YII Criteria
$Criteria=new CDbCriteria();
$Criteria->select= '*';
// $Criteria->together = true;
$Criteria->join= 'LEFT JOIN zones z ON l.zoneid = z.zoneid';
$models = Listings::model()->findAll($Criteria);
WAHT IS ERROR IN THIS
IMP : i using this on YII resful have any method if this
thank you YII