<span style="font-family:Microsoft YaHei;">查询数据重复记录 </span>
select * from Test where name in (select name from Test group by name having count(1) >= 2)
数据时间差 计算平均值
SELECT SUM(tal._time)/count(tal._time) from (
SELECT DATEDIFF(Minute, _repair.create_time,_re_info.time) AS _time FROM WBX_REPAIR _repair
LEFT JOIN WBX_REPAIR_INFO _re_info ON _repair.id = _re_info.repair_id AND _re_info.status = 1 ) AS tal
WHERE tal._time > 0
SELECT SUM(tal._time)/count(tal._time) FROM (
SELECT DATEDIFF(Minute, create_time,end_time) AS _time FROM WBX_REPAIR WHERE end_time IS NOT NULL
AND end_time > create_time AND status = '5') AS tal
where tal._time > 0 -- 故障修复的平均耗时(分钟)