mysql - How to find duplicated rows happening in a short period within a predefined time frame in sql -
i have table following
number timestamp 123456 17-09-2015 11:06 455677 17-09-2015 11:09 123456 17-09-2015 11:10 453377 17-09-2015 11:20 123456 17-09-2015 11:35 123456 17-09-2015 11:42
the result should follows:
123456 17-09-2015 11:06 123456 17-09-2015 11:10
every hour, 11:00 12:00, search numbers appear duplicate within 5 minutes. know basic sql commands. have tried duplicate rows within hour.
select t.number, group_concat(time) my_table t t.time>=now()-interval 1 hour , t.time <=now() group t.number having count(*)>1; finding duplicate records within 5 minutes in each 5 hours seems complicated me. sql statements can this? in advance.
following query give list of repetitive number
every 5 min interval:
select number,group_concat(date_time) t1 group floor(unix_timestamp(date_time)/(5 * 60)),number having count(*)>1;
verify result @ http://sqlfiddle.com/#!9/75ea0/1
group 1: 00:00:00 00:04:59 group 2: 00:05:00 00:09:59 , on..for equal duration of 5 minutes each
Comments
Post a Comment