php - MYSQL select all from table where month?

标签 php mysql sql

是否可以选择所有带有月份的字段?

例如:我有“create_date”列和该列的值:

2011-05-06 11:12:13 (this)
2012-06-06 13:12:13
2010-02-06 14:52:13
2011-05-06 21:12:13 (this)
2001-08-06 16:12:13
2011-09-06 18:12:43
2009-01-06 11:12:13
2012-02-06 12:17:55
2010-03-06 14:15:13
2012-05-06 11:19:23 (this)

如何选择月份等于05的所有字段?

最佳答案

你可以使用

SELECT create_date FROM table WHERE MONTH(create_date) = 5

关于php - MYSQL select all from table where month?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6731854/

相关文章:

php - 获取mp3文件的长度

php - LEFT JOIN 在 mySQL 中花费了很长时间

php - 如何防止 PHP 中的 SQL 注入(inject)?

sql - 帮助优化 Oracle 查询

SQL 帮助 : select the last 3 comments for EACH student?

php - 人们如何处理内容管理系统的生产阶段?

php - 如何在mysql中用一个查询从两个不同的表中选择两条记录

java - Hibernate saveOrUpdate 不会更新现有记录,而是将记录另存为新条目

sql - 我应该使用什么 mysql 查询来选择符合我所有条件的类别?

javascript - Codeigniter 3 - Ajax 文件上传(您没有选择要上传的文件)