我希望根據下一行的開始日期獲得當前行的結束日期
示例輸入
ID Date
1 1/19/2022
1 1/25/2022
1 1/26/2022
2 2/1/2022
輸出:
ID StartDate EndDate
1 1/19/2022 1/24/2022
1 1/25/2022 1/25/2022
1 1/26/2022 CurrentDate
2 2/1/2022 CurrentDate
我們如何在 Teradata 中做到這一點
uj5u.com熱心網友回復:
select id,
LEAD(datecol, 1, current_date)
over (partition by id
order by datecol
from mytable
線索回傳磁區中最后一行的下一行值和當前日期。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/494360.html
上一篇:如何在谷歌表格中建立一個計時器
