视图模型的'_as'无法使用,请教一下

浏览:605 发布日期:2015/12/08 分类:求助交流
我有一个表内两个字段相关联的,需要一个关联查询。根据手册写了个视图模型如下:class BangshouViewModel extends ViewModel {
   public $viewFields = array(
     'user'=>array('id','type','status','name','sex','phone','addtime','_as'=>'unit','_type'=>'LEFT'),
     'user'=>array('name'=>'rename','type_id','_as'=>'unitp', '_on'=>'unit.id=unitp.type_id'),
   );
 }
访问时,系统报错:1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON unit.id=unitp.type_id WHERE `type` = 1 LIMIT 1' at line 1 [ SQL语句 ] : SELECT COUNT(*) AS tp_count FROM da_user unitp ON unit.id=unitp.type_id WHERE `type` = 1 LIMIT 1
最佳答案
评论( 相关
后面还有条评论,点击查看>>