The problem is as follows, I have a table: filter-log
that stores data extracted from an activity log file with the following fields: id_log, ip, fecha, hora, consulta, code
. I show you some records:
1, 190.168.65.45, 2017-10-13, 12:07:30,categories.php?cat=carteras,A
2, 190.168.65.45, 2017-10-13, 12:22:33,categories.php?cat=bolso,B
3, 190.168.65.222, 2017-10-13, 15:30:22,categories.php?cat=zapatos,C
4, 190.168.65.240, 2017-10-14, 12:21:10,categories.php?cat=carteras,A
5, 190.168.65.240, 2017-10-14, 12:35:09, categories.php?cat=correas,D
6, 190.168.65.45, 2017-10-15, 15:20:51, categories.php?cat=correas,D
7, 190.168.65.45, 2017-10-15, 15:25:01, categories.php?cat=carteras,A
8, 190.168.249.38, 2017-10-16, 16:45:13, categories.php?cat=zapatos,C
9, 190.168.249.38, 2017-10-16, 16:53:22, categories.php?cat=carteras,A
10, 190.168.249.38, 2017-10-16, 18:25:42, categories.php?cat=zapatos,C
then, what do I need?
Generate a query that returns transactions made from the same ip per time interval (30min) and the same date.
Example:
Those with the id
1 and 2 would be shown together in a
group or record.
The one with the id 3 would be shown alone, and so successively.
Notice that 8 and 9 go together but 10 not because it is not in the time interval of 30 min, would be part of another group.
I have already tried with mysql
functions that I found by goingogle as INTERVAL
, GROUP BY
, but I do not give with the solution, some guidance?