Commit 81f14b22 authored by zhouleilei's avatar zhouleilei

Merge remote-tracking branch 'origin/master'

parents 2b8b80e5 6e05e8dd
...@@ -103,18 +103,13 @@ ...@@ -103,18 +103,13 @@
ifnull(t2.count, 0) count, ifnull(t2.duration, 0) duration, t1.`name` name ifnull(t2.count, 0) count, ifnull(t2.duration, 0) duration, t1.`name` name
from t_base_cross_info t1 from t_base_cross_info t1
left join left join
(select t1.cross_id, t1.type, t1.place_desc, (select cross_id, type, place_desc,
count(*) count, count(*) count,
sum(TIMESTAMPDIFF(SECOND, t1.start_time, ifnull(t1.end_time,now()))) duration sum(TIMESTAMPDIFF(SECOND, start_time, ifnull(end_time,now()))) duration
from t_event_info t1 from t_event_info
left join ( where type in (701, 702, 703, 707) and start_time > DATE_FORMAT(now(),'%Y-%m-%d 00:00:00')
select t2.cross_id, MAX(t2.start_time) start_time group by cross_id, type
from t_event_info t2 order by duration desc) t2
where t2.type in (701, 702, 703, 707) and t2.start_time > DATE_FORMAT(now(),'%Y-%m-%d 00:00:00')
group by t2.cross_id
) t2 on t1.cross_id = t2.cross_id and t1.start_time and t2.start_time
where t1.start_time > DATE_FORMAT(now(),'%Y-%m-%d 00:00:00')
group by t1.cross_id) t2
on t2.cross_id = t1.id on t2.cross_id = t1.id
where t1.is_signal = 1 where t1.is_signal = 1
order by t2.duration desc order by t2.duration desc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment