How can I select all rows where month 04 is from 2010, where the date column format is as follows: 2010-04-01 10:40:20 using mysql
You can use MONTH AND YEAR functions:
SELECT * FROM table WHERE MONTH(date) = 4 AND YEAR(date) = 2010
Assuming your field is a timestamp, you can use
select * from mytable where year(thefield)=2010 and month(thefield)=4;
or
select * from mytable where thefield between '2010-04-00' and '2010-04-30 23:59:59';
select * from month where month(my_date_column) = 4 and year(my_date_column) = 2010
Perhaps you could do something like this:
SELECT * FROM `table_name` WHERE YEAR(`date_column`) = 2010 AND MONTH(`date_column`) = 4
I don't know if this is the best ... but it should work!