我有下表

+--------------------------------------+---------------------+---------------------+----------+-----------------------------+----------+--------+
| id                                   | app_start           | app_end             | title    | body                        | location | allDay |
+--------------------------------------+---------------------+---------------------+----------+-----------------------------+----------+--------+
| 52e782d7-8da8-4b27-a17e-d6beb72649e8 | 2004-04-27 10:30:00 | 2005-02-18 11:00:00 | 10 years | Something.                  | NY,USA   |      0 |
| a3e11a10-26d3-407d-83b3-c3cd6cda128f | 2004-02-17 10:30:00 | 2004-02-17 11:00:00 | 12 years | Insert random message here  | NY,USA   |      0 |
+--------------------------------------+---------------------+---------------------+----------+-----------------------------+----------+--------+

这里的列是app_start类型。如果我想获取特定月份和年份的行,比如2004年2月(Feb),它将返回第二行,我将在timestamp子句中插入什么?
 SELECT * FROM table WHERE [????]

谢谢你的帮助。

最佳答案

只需使用monthyear

select *
from yourtable
where month(app_start) = 2 and year(app_start) = 2004

09-13 10:35