Selecting Month and year from SQL
If in a column I have a timestamp ie. 2010-04-01 10:40:2开发者_如何学Go0 How can I use SQL to select everything from October 2011?
SELECT *
FROM yourtable
WHERE col1 >= '2011-10-01' AND col1 < '2011-11-01'
try this:
SELECT * FROM table WHERE MONTHNAME(filed_date) = 'October' AND YEAR(field_date)='2011'
精彩评论