我正在尝试为给定的年份和月份范围选择行。(即:从<start year>+<start month>
到<end year>+<end month>
)我尝试了以下查询,但我得到了意想不到的行。我错过了什么吗?
SELECT * FROM table AS t
WHERE
((YEAR(t.column1)='<start year>' AND MONTH(t.column1)>='<start month>') OR
(YEAR(t.column1)>'<start year>' AND YEAR(t.column1)<'<end year>') OR
(YEAR(t.column1)='<end year>' AND MONTH(t.column1)<='<end month>'))