How to get a new Column from Dates

Database
New Member

How to get a new Column from Dates

Hi , 

 

I need help to create new column by comparing dates in same column . 

Data    
IDConfigDate 
10ABC10/4/2015 
10AAA8/21/2016 
10ACC6/8/2017 
10ABB1/3/2018 
    
    
Required Output  
IDConfigBeg DateEnd Date
10ABC10/4/20158/20/2016
10AAA8/21/20166/7/2017
10ACC6/8/20171/2/2018
10ABB1/3/201812/31/999 or today
1 REPLY
Highlighted
Teradata Employee

Re: How to get a new Column from Dates

Create Table Output (ID int, Config char(3), BegDate DATE, EndDate DATE)
as
Select ID, Config, "Date",
    Coalesce( MIN("Date") over (partition by ID order by "Date"
        rows between 1 following and 1 following) - 1, DATE ) -- or Date'12/31/9999'
with data
Primary Index (ID) -- or ID, Config?