位置:首页 > 网络编程 > 数据库
点击展开栏目简介
数据库技术,mysql,oracle

oracle:处理in()语法只支持1000个子项的问题

分享到: 微信 新浪微博 更多

$idarr=array(1,2,3,4,5,6,7,8,9,11,12,13,14);

$str='';
foreach(array_chunk($idarr, 5) as $val){
    $t='';
	foreach($val as $v){
		$t.=$v.',';
	}
	$t=rtrim($t,',');
	$str.="user_id in(".$t.") or ";
}
$str=trim($str,' or');
// echo $str; user_id in(1,2,3,4,5) or user_id in(6,7,8,9,11) or user_id in(12,13,14)
$s="update mina2_user set user_isexport=2 where ".$str;
echo $s;
//update tb set isexport=2 where user_id in(1,2,3,4,5) or user_id in(6,7,8,9,11) or user_id in(12,13,14)



上篇:sql:连接查询left join的条件放在on里和where里的区别

发表评论 ​共有​条评论
  • 匿名发表