【发布时间】:2021-10-15 00:09:44
【问题描述】:
我想得到实际月份,月份-1,月份-2。和当前月份,但少了 1 年
例如,我在我的 where 中这样做了:
where extract(year from date) = 2021 or
extract(month from date) = 06
orextract(month from date) = 07
orextract(month from date) = 08
or (extract(year from date) = 2020 and
and extract(month from date) = 08)
但我想知道如何自动完成,所以我不需要每个月自己更改。
谢谢
【问题讨论】:
-
样本数据和预期结果会有所帮助。