Jump to content

Comparing Relative Dates in MySQL DB


Lytheum

Recommended Posts

Hmm. I have a mysql DB with many fields, say, 200, 300? Each one of them has a time in string format (ex:1212127274).

 

What I would like to do is..

 

Select the info from the database that is within 5 minutes of each other. So, roughly:

 

Group 1:

Field18, 1212127273

Field13, 1212127272

Field99, 1212127271

Field22, 1212127274

 

Group 2:

Field86, 1212127269

Field14, 1212127264

Field57, 1212127262

Field26, 1212127268

 

I'm very sorry if this isn't clear enough, it's so hard for me to explain.

 

Link to comment
https://forums.phpfreaks.com/topic/107952-comparing-relative-dates-in-mysql-db/
Share on other sites

Ok this is how I understand your question

 

I have a mysql DB with many fields, say, 200, 300?

I interpret as:

I have a mysql DB and one of the tables inside this DB has many records, say, 200, 300?

 

Each one of them has a time in string format (ex:1212127274).

I interpret as:

Each one of them has is stored as a UNIXTIME (ex:1212127274).

 

Select the info from the database that is within 5 minutes of each other.

I interpret as:

Group the info from the table that has a UNIXTIME difference of 5 minutes

 

Before I go any further lets make sure we on the same page :P.

 

One last thing. Do you want the times within 5 minutes from each other or the times within 5 seconds of each other, because the examples you gave for each group are within 5 seconds from each other

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.