通过group by和having去除重复

$sql="SELECT peisonghao FROM ecs_order_info_ly GROUP BY peisonghao HAVING COUNT(*) >1";

$rlt=$GLOBALS['db']->query($sql);

while($data=$GLOBALS['db']->fetch_array($rlt)){

$rand=rand(10000,10000000);

$sql="update ecs_order_info_ly set order_sn='$rand' where order_id=".$data['order_id'];

$GLOBALS['db']->query($sql);

}

SELECT peisonghao FROM ecs_order_info_ly GROUP BY peisonghao HAVING COUNT(*) >1 把重复的行选出来

上一篇:USB设备(移动硬盘、鼠标)掉电掉驱动的两种解决方案


下一篇:CentOS7 安装 net-speeder 提升 VPS 网络性能