How to write a SQL query that runs every 10 minutes?

246
May 23, 2017, at 03:45 AM

I want to find the 10 most searched destinations for each 10-minute interval starting at midnight i.e. 00:00:00. I am using MYSQL sever on Windows. Below is the structure of the table clicklog_20:

  user_id     bigint(20)
  timecl      time
  action      text
  destination text
  hotel       text

I have written the query to give me the 10 most searched destinations with the following query:

select destination,count(*) 
from clicklog_20
where destination is not NULL
group by destination
order by destination desc 
limit 10;

Now I want to do this every 10 minutes on column timecl in the table. Below are sample records in the table

user_id             timecl      action  destination  hotel
2017032000000000129 00:18:36    Click   Berlin       SensCity Berlin Spandau
2017032000000000129 00:16:12    Click   Berlin       Azimut Berlin City South
2017032000000000129 00:05:04    Click   Cottbus      City Cottbus
2017032000000000129 00:01:50    Click   Cottbus      Ostrow
2017032000000000129 00:12:05    Click   Berlin       Days Inn Berlin West

Is there a way to use time interval functions like DATE_FORMAT(). If Cronjob or task scheduler is the way to do it could you please point me to a tutorial for that, I would appreciate it.

Rent Charter Buses Company
READ ALSO
HTML PHP - Professionial URLs and why can't I use php include within html file?

HTML PHP - Professionial URLs and why can't I use php include within html file?

So I just have begun to build a website from the groundupI have never did this before

270
Php does not show the lowest value

Php does not show the lowest value

I want to see the highest and lowest Value using phpBut it show the max value 9

259
How to get a php session variable and use it in the where clause at ssp to get a single ligne record with datatable

How to get a php session variable and use it in the where clause at ssp to get a single ligne record with datatable

I spend hours on searching for a solution to filter table and show only the ligne recordes where column equal the value of session variable for that i try this:

231
how do i verify an email from the database?

how do i verify an email from the database?

i tried verifying and email from my database, but it won't check if it exist or not, please how do it fix it? here i what i've tried out;

280