开发者

Selecting Month and year from SQL

开发者 https://www.devze.com 2023-04-12 17:33 出处:网络
If in a column I have a timestamp ie. 2010-04-01 10:40:2开发者_如何学Go0How can I use SQL to select everything from October 2011?SELECT *

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

精彩评论

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

关注公众号