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
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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.