thinkphp 查询语句 in 的相关问题
我的sql语句如下:selectDISTINCTb.paperid,b.paperdesfromtp_reportdzbwhereb.remark=0andb.depid...
我的sql语句如下:
select DISTINCT b.paperid,b.paperdes from tp_reportdz b where
b.remark=0 and b.depid in(select a.depid from tp_dept_user a where a.username='A');
我将其翻译到thinkphp语言是这样的:
$where['depid']=$user->where($condition)->Field('depid')->select();
$cond['depid']=array('in',$where);
$cond['remark']=1;
M('user')->where($cond)->select();
这样写有什么问题呢?这不是in条件查询码?array('in',$where)传不进值,why? 展开
select DISTINCT b.paperid,b.paperdes from tp_reportdz b where
b.remark=0 and b.depid in(select a.depid from tp_dept_user a where a.username='A');
我将其翻译到thinkphp语言是这样的:
$where['depid']=$user->where($condition)->Field('depid')->select();
$cond['depid']=array('in',$where);
$cond['remark']=1;
M('user')->where($cond)->select();
这样写有什么问题呢?这不是in条件查询码?array('in',$where)传不进值,why? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询