gala Posted April 18, 2009 Share Posted April 18, 2009 our database stores the time in datetime format (YYYY-MM-DD HH:MM:SS). Assuming it stores it in "date" column. I need to select entries only between certain days. I am using this query:select * from table_name where date between '2009-04-01 00:00:00' and '2009-04-05 24:59:59'this return Empty set, but I know for sure that data is there. Would you, please, correct my query. thank you Link to comment Share on other sites More sharing options...
justsomeguy Posted April 19, 2009 Share Posted April 19, 2009 Different databases use different date formats for their queries. Look up the manual for the database you're using to find out which format to use for the field type you're using. Don't assume it's a "date" column. Look it up. Link to comment Share on other sites More sharing options...
gala Posted April 22, 2009 Author Share Posted April 22, 2009 I got it! it is actually pretty simple. there are 24 hours in day, not 25 I had '24:59:59', should be '23:59:59'. the rest is right! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.