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
https://forums.phpfreaks.com/topic/193601-query-range-of-dates-in-mysql/
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.

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.