//把已安装的主程序版本取出来,然后去掉重复
$main_ver_arr_new = array_unique($main_ver_arr);//数组去重复
$main_ver_str = implode(',', $main_ver_arr_new);//逗号分隔的主程序版本号
$dir_ids = $ProgramDirsModel->where(array('program_classid'=>$uuid))->getField('classid',true);
$dir_ids2 = M('ProgramsTrasharticles')->where(array('program_classid'=>$uuid))->getField('classid',true);
$new_dir_ids = array_unique(array_merge($dir_ids,$dir_ids2));
//同一字段不重复查询
$public_resolution_list = $rmfModel->field("distinct file_px")->where($publicwhere)->select();
//同一字段不重复查询
$Model->distinct(true)->field('name')->select();
生成的SQL语句是: SELECT DISTINCT name FROM think_user
distinct方法的参数是一个布尔值。
//同一字段不重复统计
$totals = $stuSignInModel->where($map)->field("COUNT(DISTINCT convert(VARCHAR(10),signIntime,120)) as total")->count();
$total = $totals[0]['total'];
评论