如题:连接sql 2005数据库,使用视图模型
<?php
namespace Index\Model;
use Think\Model\ViewModel;
class CommentaViewModel extends ViewModel{
public $viewFields=array(
'comment'=>array('gid','comment','pic','time'=>'cctime','status'=>'cstatus','_as'=>'aa'),
'guest'=>array('avatar','username','_as'=>'bb','_on'=>'aa.gid=bb.id'),
);
}
?>
代码中使用order排序就会报错,不使用排序则正常,,有没有大侠碰到过这样的问题?
$comment=$Model->where($where)->limit($limit)->order('cctime')->select();
------报错:ERR: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]无法绑定由多个部分组成的标识符 "aa.time"。$comment=$Model->where($where)->limit($limit)->select();
----正常查了很久没有找到答案,请见过的大侠说说怎么回事
最佳答案
