ess14 Posted February 20, 2007 Share Posted February 20, 2007 Having a little problem working out the proper sql for this query.... What im trying to do is return some results grouped by the month they were added. So how do i do that in sql when my columns are in DATE type. so, say the date is 2007-02-20 in my date field, how do i use SQL to just return the month(ie 02) so that i can group it? Can i use DATEPART() on a Date type column? thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/39269-solved-sql-date/ Share on other sites More sharing options...
effigy Posted February 20, 2007 Share Posted February 20, 2007 MONTH or DATE_FORMAT. Quote Link to comment https://forums.phpfreaks.com/topic/39269-solved-sql-date/#findComment-189238 Share on other sites More sharing options...
ess14 Posted February 20, 2007 Author Share Posted February 20, 2007 cheers for that... month worked. Quote Link to comment https://forums.phpfreaks.com/topic/39269-solved-sql-date/#findComment-189271 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.