Archives of the TeradataForum
Message Posted: Thu, 20 Dec 2012 @ 20:03:56 GMT
I need to get the previous and next action of the current action (row).I am able to achieve this is in oracle by the below logic,
LEAD(action_name,1) OVER(PARTITION BY ID,request_name ORDER BY timestamp_det) next_action LAG(action_name,1) OVER(PARTITION BY ID,request_name ORDER BY timestamp_det) previous_action
Please let me know how to implement the same in Teradata.
Note: Find the sample input and expected output details for your reference.
id request_name timestamp_det action_name 10 account open 01-OCT-12 09.00.31.895478000 AM submit 10 account open 01-OCT-12 09.00.31.897796000 AM valideta 10 registration level1 01-OCT-12 09.00.31.932583000 AM submit 10 registration level1 01-OCT-12 184.108.40.2060491000 AM chkout 10 registration level1 01-OCT-12 220.127.116.11842000 AM approve 10 registration level1 01-OCT-12 18.104.22.168683000 AM chkin 10 account approve 01-OCT-12 22.214.171.1247172000 AM comple
id previous_action Current action next_action 10 submit validate 10 submit valideta 10 submit chkout 10 submit chkout approve 10 chkout approve chkin 10 approve chkin 10 comple
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|