开发者

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'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜