从表中获取在日期字段中具有搜索月份的所有条目 [英] Get all entries from a table which have the searched month in a date field
本文介绍了从表中获取在日期字段中具有搜索月份的所有条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含 3 个字段的表:ID
、startdate
、stopdate
.
I have a table that has 3 fields: ID
, startdate
, stopdate
.
它们的类型为日期".
如何选择给定月份中具有 startdate
的所有条目?
How can I select all entries which have the startdate
in a given month?
例如:显示 startdate
在08"月份的所有条目.
For example: Show me all entries where the startdate
is in the month "08".
这可能吗?
推荐答案
SELECT *
FROM tblName
WHERE MONTH(startdate) = 8
<小时>
逐行拆分:
Line by line break-up:
SELECT *
=> 选择所有列FROM tblName
=> 应从tblName
表中获取行.WHERE MONTH(startdate) = 8
=>startdate
在 08 月.
SELECT *
=> selects all columnsFROM tblName
=> the rows should be fetched fromtblName
table.WHERE MONTH(startdate) = 8
=> thestartdate
is in the month 08.
这篇关于从表中获取在日期字段中具有搜索月份的所有条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文