mysql中,下面哪种查询效率比较高?
一:$notDealEmailArr=$elanw_client_caiji->getObjectList("selectcIdfromelanw_client_caij...
一:
$notDealEmailArr=$elanw_client_caiji->getObjectList("select cId from elanw_client_caiji where type=2 and addtime<='".$time."'");//审核未通过且14天以前的数据
foreach($notDealEmailArr as $k=>$v){
$cUser=$elanw_client->select('cId='.$v['cId'],'cUser');//获取业务员
$isUser=$userinf->select("name='".$cUser['cUser']."' and forbid<>'yes' and joinstate <>2",'name');//判断业务员是否是正式用户
if($isUser){
$updateArr= array(
array("columnName"=>"cUser","columnValue"=>'wbpub'),
);
$elanw_client->update($updateArr,"cId=".$v['cId']);//转入外部资源库
$updateArr2= array(
array("columnName"=>"type","columnValue"=>'0'),
);
$elanw_client_caiji->update($updateArr2,"cId=".$v['cId']);//审核状态变为待审核
}
}
二:
$idArr=$elanw_client->getList('allList', "and cId in(select cId from elanw_client_caiji where type=2 and addtime<='$time') and cUser in(select name from userinf where forbid<>'yes' and joinstate <>2)",'','', '', array('fields'=>'cId'),'');//获取14天前审核不通过的且已被领取的数据
foreach($idArr as $k=>$v){
$updateArr= array(
array("columnName"=>"cUser","columnValue"=>'wbpub'),
);
$elanw_client->update($updateArr,"cId=".$v['cId']);//转入外部资源库
$updateArr2= array(
array("columnName"=>"type","columnValue"=>'0'),
);
$elanw_client_caiji->update($updateArr2,"cId=".$v['cId']);//审核状态变为待审核
}
直接说下面哪种查询比较好啊
法一:
$A=query(select name from tableA where id in(select id from tableB where logintime<='2016-04-21 14:20:00'));
法二:
$B=query(select id from tableB where logintime<='2016-04-21 14:20:00');
foreach($B as $v){
$C=query(select name from tableA where id=$v['id']);
} 展开
$notDealEmailArr=$elanw_client_caiji->getObjectList("select cId from elanw_client_caiji where type=2 and addtime<='".$time."'");//审核未通过且14天以前的数据
foreach($notDealEmailArr as $k=>$v){
$cUser=$elanw_client->select('cId='.$v['cId'],'cUser');//获取业务员
$isUser=$userinf->select("name='".$cUser['cUser']."' and forbid<>'yes' and joinstate <>2",'name');//判断业务员是否是正式用户
if($isUser){
$updateArr= array(
array("columnName"=>"cUser","columnValue"=>'wbpub'),
);
$elanw_client->update($updateArr,"cId=".$v['cId']);//转入外部资源库
$updateArr2= array(
array("columnName"=>"type","columnValue"=>'0'),
);
$elanw_client_caiji->update($updateArr2,"cId=".$v['cId']);//审核状态变为待审核
}
}
二:
$idArr=$elanw_client->getList('allList', "and cId in(select cId from elanw_client_caiji where type=2 and addtime<='$time') and cUser in(select name from userinf where forbid<>'yes' and joinstate <>2)",'','', '', array('fields'=>'cId'),'');//获取14天前审核不通过的且已被领取的数据
foreach($idArr as $k=>$v){
$updateArr= array(
array("columnName"=>"cUser","columnValue"=>'wbpub'),
);
$elanw_client->update($updateArr,"cId=".$v['cId']);//转入外部资源库
$updateArr2= array(
array("columnName"=>"type","columnValue"=>'0'),
);
$elanw_client_caiji->update($updateArr2,"cId=".$v['cId']);//审核状态变为待审核
}
直接说下面哪种查询比较好啊
法一:
$A=query(select name from tableA where id in(select id from tableB where logintime<='2016-04-21 14:20:00'));
法二:
$B=query(select id from tableB where logintime<='2016-04-21 14:20:00');
foreach($B as $v){
$C=query(select name from tableA where id=$v['id']);
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询