【发布时间】:2019-04-01 14:23:46
【问题描述】:
我有下表。
我想确定 start_date 和 end_date 的重叠间隔。
*edit 我想删除那些行重叠的开始日期和结束日期之间天数最少的行。
例子:
pgid 1 & pgid 2 have overlapping days. Remove the row that has the least amount of days between start_date and end_date.
表 A
id pgid Start_date End_date Days
1 1 8/4/2018 9/10/2018 37
1 2 9/8/2018 9/8/2018 0
1 3 10/29/2018 11/30/2018 32
1 4 12/1/2018 sysdate 123
预期结果:
id Start_date End_date Days
1 8/4/2018 9/10/2018 37
1 10/29/2018 11/30/2018 32
1 12/1/2018 sysdate 123
【问题讨论】:
标签: sql oracle window-functions