查询数据库某个字段的重复记录

select * from TableA where b in (select  b from  TableA group  by  b having  count(b) > 1)

 

获取重复数据


function repeating_data($array) { 
    $len = count ( $array ); 
    for($i = 0; $i < $len; $i ++) { 
        for($j = $i + 1; $j < $len; $j ++) { 
            if ($array [$i] == $array [$j]) { 
                $repeat_arr [] = $array [$i]; 
                break; 
            } 
        } 
    } 
    return $repeat_arr; 

你可能感兴趣的:(php)