stublackett Posted November 5, 2009 Share Posted November 5, 2009 Hi, I'm just doing a bit of archiving news by Season for a Football Site. Looking to archive the news per season and it falls between these dates : 01/01/09 and 30/06/09 The date is formatted in UK Date format. I've got this at the moment : SELECT *, DATE_FORMAT( date, '%d/%m/%y' )AS uk_date FROM news WHERE newstype = 'Match Report' AND date => '01-01-09 AND <= 31-06-09' ORDER BY nid DESC But its just erroring out... Any help appreciated Link to comment https://forums.phpfreaks.com/topic/180398-select-query-between-two-dates/ Share on other sites More sharing options...
kickstart Posted November 5, 2009 Share Posted November 5, 2009 Hi You are checking for a date that is >= '01-01-09 AND <= 31-06-09', and that string isn't a valid date. However you probably should use BETWEEN, and also use the real format for dates. SELECT *, DATE_FORMAT( date, '%d/%m/%y' )AS uk_date FROM news WHERE newstype = 'Match Report' AND date BETWEEN '2009-01-01' AND '2009-06-31' ORDER BY nid DESC All the best Keith Link to comment https://forums.phpfreaks.com/topic/180398-select-query-between-two-dates/#findComment-951705 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.