试图模型提示错误

浏览:522 发布日期:2013/03/09 分类:求助交流
Column 'id' in where clause is ambiguous [ SQL语句 ] : SELECT Posts.id AS id,Posts.title AS title,User.name AS username FROM posts Posts JOIN user User ON Posts.userid=User.id WHERE id=57


/////

<?php
// 本类由系统自动生成,仅供测试用途
class PostsViewModel extends ViewModel {
public $viewFields = array(
'Posts'=>array('id','title'),
'User'=>array('name'=>'username', '_on'=>'Posts.userid=User.id'),
);
}

////


<?php
// 本类由系统自动生成,仅供测试用途
class PostsViewAction extends Action {
public function index(){
$Posts = D("PostsView");
$this->Posts=$Posts->field('id,title,username')->where('id=57')->select();
$this->display();

}

}
最佳答案
评论( 相关
后面还有条评论,点击查看>>