0
我想过滤按日期记录,所以我增加了CDbCriteria addConditions where子句是暧昧
createDate BETWEEN ' . $dateRange['start'] . ' AND ' . $dateRange['end']
为了我的标准,但我得到:
CDbCommand failed to execute the SQL statement:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'createDate' in where clause is ambiguous
这是我的代码:
$criteria=new CDbCriteria;
$criteria->with = array(
'Contacts' => array('alias'=> 'Contacts', 'together' => true,),
'Lisings' => array('alias'=> 'listings', 'together' => true,),
);
$criteria->addCondition('createDate BETWEEN ' . $dateRange['start'] . ' AND ' . $dateRange['end']);
$result = Model::model('Portfolio')->findAll($criteria);
修复此错误的任何提示?我也试过portfolio.createDate
,但它不起作用。
感谢
谢谢你,谢谢作品! – user3844579