over9k Posted December 24, 2009 Share Posted December 24, 2009 SELECT * FROM `schedule` WHERE `date`='2010-01-01' also tried: SELECT * FROM `schedule` WHERE `date`='2010-01-01 *' SELECT * FROM `schedule` WHERE `date`='2010-01-01 *:*:*' I'm trying to get all records from a certain day disregarding the time portion but the above code is only returning one record when there are many records for a particular day A record looks something like: [pre] id date 0000 0000-00-00 00:00:00 [/pre] The date field is type datetime MySQL server version -- 5.1.30 Link to comment https://forums.phpfreaks.com/topic/186228-query-all-records-with-a-particular-date/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 24, 2009 Share Posted December 24, 2009 SELECT * FROM `schedule` WHERE DATE(date) ='2010-01-01' Link to comment https://forums.phpfreaks.com/topic/186228-query-all-records-with-a-particular-date/#findComment-983512 Share on other sites More sharing options...
over9k Posted December 24, 2009 Author Share Posted December 24, 2009 Thanks PFMaBiSmAd, it worked perfectly I just found the mySQL date functions. I have a second question: Is there any problem with using datetime type as a primary key if the only precision needed is to the minute? Link to comment https://forums.phpfreaks.com/topic/186228-query-all-records-with-a-particular-date/#findComment-983513 Share on other sites More sharing options...
fenway Posted December 27, 2009 Share Posted December 27, 2009 PKs should usually be integers. Link to comment https://forums.phpfreaks.com/topic/186228-query-all-records-with-a-particular-date/#findComment-984600 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.