Jump to content

Recommended Posts

Hi Guys,

 

SELECT *
FROM `Example`
WHERE `DateTime` = "2007-08-28 15:24:44"

 

How do I get my query to find either the above entry or the closest matching one?

 

DateTime column is of course of type DateTime.

 

Any help would be really appreciated.

 

thanks,

newbie

Link to comment
https://forums.phpfreaks.com/topic/74305-query-problem-realting-to-datetime/
Share on other sites

well the one that is on the same date and is as close to that time as possible.

 

doesn't matter weather it is before or after that time.

 

If there is an entry in the database that is 2 seconds before query or 5 seconds after the query, you take the closest which would be 2 seconds before it.

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.