Request records that match a time interval in MySQL

3

I have a table where I make a record every minute. The column where I keep the time of each insertion is of type TIME . I want to make a query that I select the records that with an interval of 2 minutes.

I mean, show me something similar to this:

Column 01:00:00, 01:02:00, 01:04:00, 01:06:00, 01:08:00, 01:10:00, 01:12 : 00, etc ...

The column of my table is as follows:

    
asked by user50655 07.07.2017 в 20:45
source

1 answer

4

Without knowing much more about your board, capable of some madness like that, it's useful for you:

select * from tabla where mod(MINUTE(mkm),2) = 0

That gets the minute of the time, and it looks for the rest against 2, that if it gives zero it means that it is multiplo of 2 .. that is every 2 minutes ... if you wanted it to be every two odd minutes, you should only do :

 select * from tabla where mod(MINUTE(mkm),2) = 1
    
answered by 07.07.2017 в 20:58