When you add a new column from an existing column - do you had to use add column or can you just drop it in? My orig table dosn't have Previous Day or Next Day - those are the columns I'm adding. Should this work?
SELECT
ACCT_NUM,
PRODUCT,
Date_local,
CURRENTDAY,
LAG[CURRENTDAY,1,0] OVER(PARTITION BY ACCT_NUM ORDER BY Date_local DESC) AS PREVIOUSDAY,
LEAD[CURRENTDAY,1,0] OVER(PARTITION BY ACCT_NUM ORDER BY Date_local DESC) AS NEXTDAY,
FROM FINANCE.REVENUE03
Or I could alter table?
ALTER TABLE REVENUE03
ADD COLUMN PREVIOUSDAY=
LAG[CURRENTDAY,1,0] OVER(PARTITION BY ACCT_NUM ORDER BY Date_local DESC);
ADD COLUMN NEXTDAY=
LEAD[CURRENTDAY,1,0] OVER(PARTITION BY ACCT_NUM ORDER BY Date_local DESC)
END
VIEWinstead.VIEWor even aFUNCTIONinstead of using a window function in a computed column which is not possible?