-1

I have a table that has 3 fields: ID, startdate, stopdate.

They have the type "date".

How can I select all entries which have the startdate in a given month?

For example: Show me all entries where the startdate is in the month "08".

Is this possible?

4

2 回答 2

1

除非我错过了什么,这是显而易见的

select * from mytable where month(date_field) = 8
于 2013-09-05T14:37:21.233 回答
1
SELECT *
FROM tblName
WHERE MONTH(startdate) = 8

逐行分解:

  1. SELECT *=> 选择所有列
  2. FROM tblName=> 应该从tblName表中获取行。
  3. WHERE MONTH(startdate) = 8=>startdate是在08月。
于 2013-09-05T14:36:26.880 回答