I know that it is very easy, have done it by some how
is there any easy to extract month from datetime
2003-01-01 01:01:02
the thing that I want to do is extract the records that are specific
month
select * from table where datetime_column=MONTH('2003-01-02')
Extracting month from datetime data type
Moderator: General Moderators
you can do this:
have a look at http://www.mysql.com/doc/en/String_functions.html for further details
Code: Select all
select * from table where SUBSTRING(datetime_column,6,2)=MONTH('2003-01-02');or just

Code: Select all
select * from table where MONTH(datetime_column)=MONTH('2003-01-02');- devork
- Forum Contributor
- Posts: 213
- Joined: Fri Aug 08, 2003 6:44 am
- Location: p(h) developer's network
problem resolved some how
first one is working [how i forgot that]cybaf wrote:or justCode: Select all
select * from table where MONTH(datetime_column)=MONTH('2003-01-02');
second one is returning NULL
thanx by the way