update ec_amount_detail as t1 set t1.data_status =0
where t1.type = 4 AND t1.order_no in (SELECT * from (select t2.order_no from ec_amount_detail AS t2 where t2.type = 4 and t2.data_status = 1 group by t2.order_no having count(t2.order_no) > 1)as temp1)
and t1.id not in (SELECT * from (select min(t3.id) from ec_amount_detail AS t3 where t3.type = 4 and t3.data_status = 1 group by t3.order_no having count(t3.order_no)>1)as temp2)