Jump to content

Query range of dates in MYsql


TheFilmGod

Recommended Posts

SELECT * FROM calendar_events WHERE datetime BETWEEN '2010-01-01 00:00:00' AND '2010-01-31 23:59:59'

 

A very very very basic SELECT statement that doesn't seem to work. This is part 1 of a complicated JOIN I am doing. But since this doesn't seem to pull up any records from the database, the complicated JOIN will not work.

 

Thanks for your help!

Link to comment
Share on other sites

There is nothing technically wrong with that query.

 

It would take seeing an example of data in the datetime column that you expect to be returned and what the column definition is for anyone to have a chance at telling you why nothing is being returned. Also, how did you execute this query and display the results or otherwise determine that there were no matching rows returned?

 

Edit: Also how is the query being produced, because something like a non-printing character, such as a newline or a null, as part of the '2010-01-01 00:00:00' ... values would prevent a match.

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.