Viewing 6 posts - 1 through 6 (of 6 total)
Hi all, thanks for replies. I have updated my query the below way.
SELECT
S_ID,
LAG(S_ACTV_CODE, 1) OVER (PARTITION BY S_ID ORDER BY S_DATETIME ASC)...
July 2, 2015 at 6:05 pm
I tried using several ways including using 'Partition by' but couldn't succeed. The above query is bit closer to my results.
July 2, 2015 at 9:56 am
Ok, no problem. Thanks once again for your prompt response.
July 2, 2015 at 9:29 am
What I mean is, it's working partially. It's giving all columns correct values, except End_Time.
For a single S_ID it is giving correct value but when I query on all S_IDs...
July 2, 2015 at 9:16 am
Hi Sean,
I have written a code like below:
SELECT
S_ID,
LAG(S_ACTV_CODE, 1) OVER (ORDER BY S_DATETIME ASC) AS S_ACTV_CODE_PREV,
S_ACTV_CODE,
S_USER,
S_DATETIME AS START_TIME,
LEAD(S_DATETIME, 1) OVER (ORDER BY S_DATETIME ASC) AS END_TIME,
DATEDIFF (SECOND, S_DATETIME,
LEAD(S_DATETIME, 1) OVER...
July 2, 2015 at 8:49 am
Hi Sean
Thanks for your reply. I have written a code using LEAD/LAG but it is working partially.
As I am new to this forum, not sure where I can create...
July 2, 2015 at 7:57 am
Viewing 6 posts - 1 through 6 (of 6 total)