jjmusicpro Posted January 16, 2009 Share Posted January 16, 2009 Hi, I was running a date query and it seems my 2008 querys work, however when i look at 2009 querys, it goes back in time. SELECT TOP 1 * FROM Table where P1Name='Billy Jones'and Date BETWEEN '12/21/2008' AND '1/9/2009' ORDER BY Date DESC Link to comment https://forums.phpfreaks.com/topic/141025-date-query/ Share on other sites More sharing options...
jjmusicpro Posted January 16, 2009 Author Share Posted January 16, 2009 For example if i run this SELECT * FROM Table WHERE Date BETWEEN '12/10/2008' AND '12/23/2008' It works, however if I run this SELECT * FROM Table WHERE Date BETWEEN '12/10/2008' AND '12/23/2009' I bring Back NO records Link to comment https://forums.phpfreaks.com/topic/141025-date-query/#findComment-738131 Share on other sites More sharing options...
machupicchu Posted January 16, 2009 Share Posted January 16, 2009 are you using MySQL? try the dates in the following format: 2009-12-23 Link to comment https://forums.phpfreaks.com/topic/141025-date-query/#findComment-738135 Share on other sites More sharing options...
machupicchu Posted January 16, 2009 Share Posted January 16, 2009 also, next time you should post this in one of the SQL / Database Forums Link to comment https://forums.phpfreaks.com/topic/141025-date-query/#findComment-738136 Share on other sites More sharing options...
jjmusicpro Posted January 16, 2009 Author Share Posted January 16, 2009 I am using MSSQL thats what they have installed not MYSQL. SO any ideas? Strange....... This works SELECT * FROM Table WHERE Date BETWEEN '11/10/2008' AND '12/25/2009' SELECT * FROM Table WHERE Date BETWEEN '12/10/2008' AND '12/25/2009' BUt it only brings back stuff from 2008 NOT 2009 This does not work SELECT * FROM Table WHERE Date BETWEEN '11/10/2008' AND '1/25/2009' If I run this SELECT * FROM Table WHERE Date BETWEEN '1/1/2009' AND '12/25/2009' It brings back ALL records, and this is wrong. Link to comment https://forums.phpfreaks.com/topic/141025-date-query/#findComment-738140 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.