本文介绍了按字段月份选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用月/年从表中获取记录?我有一张这样的桌子:

How can I get records from my table using month/year? I have a table like this:

Name - varchar
DueDate -datetime
Status -boll

DueDate是项目的截止日期,我想要对应于月份/年份的记录,而不是完整的日期,我的意思是特定月份的记录.

DueDate is project due date, I want record corresponding to month/year, not full date, I mean record for specific month.

如何在mysql中做到这一点?

How can I do this in mysql?

推荐答案

只需使用 MONTH()年():

SELECT * FROM Project WHERE MONTH(DueDate) = 1 AND YEAR(DueDate) = 2010

这篇关于按字段月份选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 08:12
查看更多