dreampho Posted June 12, 2012 Share Posted June 12, 2012 Hi. I have a date in format YYYYMMDD. I want to display results where the MM is equal to something. How can I do this without it checking against the YYYY or DD? Thank you Quote Link to comment Share on other sites More sharing options...
Illusion Posted June 12, 2012 Share Posted June 12, 2012 Check this.. http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_month Quote Link to comment Share on other sites More sharing options...
dreampho Posted June 12, 2012 Author Share Posted June 12, 2012 Ah I see, thank you. But how would I add this into the WHERE? Thanks Quote Link to comment Share on other sites More sharing options...
trq Posted June 12, 2012 Share Posted June 12, 2012 As an example, select records where the month is June: SELECT fld FROM tbl WHERE MONTH(some_date_fld) = '6'; Quote Link to comment Share on other sites More sharing options...
dreampho Posted June 12, 2012 Author Share Posted June 12, 2012 Thank you for the example! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.