Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Get previous column vale till it reaches another not null value - response (2) by M.Saeed Khurram

$
0
0

Hi Bikky,
I hope the following query will fullfil your requirement.

SEL
M.EMPNO AS MAIN_EMP,
M.EFF_DT AS MAIN_DT,
--L.TYPE_CD,
MAX(TYPE_CD) OVER(ORDER BY M.EFF_DT RESET WHEN TYPE_CD IS NOT NULL) AS NEW_TYPE_CD
FROM td3471.MAIN M LEFT JOIN td3471.LKP L ON M.EMPNO=L.EMPNO AND M.EFF_DT=L.EFF_DT;

Please let me know if I had missed anything.
 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>