问题描述
比较日期范围时遇到问题。我必须验证特定月份和年份内的日期。月和年是整数值。
注意:我正在通过Oracle数据库使用OUTSYSTEMS聚合
两个查询结果的示例:
Start Date End Date
1 2020-08-16 2020-10-14
2 2019-11-01 2020-08-15
案例1
输入:
Month = 9
Year = 2020
预期结果:
Start Date End Date
1 2020-08-16 2020-10-14
案例2
输入:
Month = 8
Year = 2020
预期结果:
Start Date End Date
1 2020-08-16 2020-10-14
2 2019-11-01 2020-08-15
案例3
输入:
Month = 3
Year = 2020
预期结果:
Start Date End Date
2 2019-11-01 2020-08-15
案例4
输入:
Month = 10
Year = 2019
预期结果:无行
以Java方式进行选择。我正在使用Month()和Year()之类的系统函数将行转换为整数。
赞
((Month(StartDate) <= Month and Month(EndDate) = Month)
and
(Year(StartDate) <= Year and Year(EndDate) = Year))
or
((Month(StartDate) <= Month and Month(EndDate) = Month)
and
(Year(StartDate) <= Year and Year(EndDate) = Year))
上面的代码不起作用。我尝试了许多组合但均未成功。我没有特殊的比较功能。为了进行分析,我创建了四个方案来带出我正在研究的月份和年份中包含的日期。但是我没有使代码起作用。有人可以为我开路
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)