Hello,
I have a table holding values as below: (also I attached the table picture as well)
rownum Id UserID DecisionTypeDetailDate RushTypeKey ExpectedRushType
1 35428225 System 2014-04-22 22:38:19 8 8
2 35428225 RECALL 2014-04-26 15:05:00 8 8
3 35428225 System 2014-04-26 15:06:57 8 8
4 35428225 AZZOL 2014-04-26 15:48:31 7 7
5 35428225 CHAXY2 2014-04-26 16:02:55 6 6
6 35428225 System 2014-04-28 13:56:13 8 6
7 35428225 System 2014-04-28 13:56:13 8 6
8 35428225 AZZOL 2014-04-28 14:55:53 4 4
9 35428225 TSAPY2 2014-04-28 19:26:45 6 6
10 35428225 System 2016-05-09 21:52:34 8 6
11 35428225 GIYKIJ2 2016-05-11 13:46:24 5 5
12 35428225 HILN2 2016-05-11 14:34:36 5 5
13 35428225 System 2016-05-11 22:45:52 8 5
14 35428225 GIYKIJ2 2016-05-12 14:31:02 6 6
15 35428225 ROBINM2 2016-05-12 17:12:58 7 7
I would like to update the value in RushType column same as ExpectedRushType column.
The rule is if the UserID in ('System','RECALL') then I need to update RushType value same as previous row rushType value which is UserID NOT in ('System','RECALL').
If there is no previous record then keep the same value as is.
NOTE (Table does't have ExpectedRushType colum. I just added to show what I am looking for) Table shows only one ID and ordered by DecisionTypeDetailDate
Any help greatly appreciated.
I have a table holding values as below: (also I attached the table picture as well)
rownum Id UserID DecisionTypeDetailDate RushTypeKey ExpectedRushType
1 35428225 System 2014-04-22 22:38:19 8 8
2 35428225 RECALL 2014-04-26 15:05:00 8 8
3 35428225 System 2014-04-26 15:06:57 8 8
4 35428225 AZZOL 2014-04-26 15:48:31 7 7
5 35428225 CHAXY2 2014-04-26 16:02:55 6 6
6 35428225 System 2014-04-28 13:56:13 8 6
7 35428225 System 2014-04-28 13:56:13 8 6
8 35428225 AZZOL 2014-04-28 14:55:53 4 4
9 35428225 TSAPY2 2014-04-28 19:26:45 6 6
10 35428225 System 2016-05-09 21:52:34 8 6
11 35428225 GIYKIJ2 2016-05-11 13:46:24 5 5
12 35428225 HILN2 2016-05-11 14:34:36 5 5
13 35428225 System 2016-05-11 22:45:52 8 5
14 35428225 GIYKIJ2 2016-05-12 14:31:02 6 6
15 35428225 ROBINM2 2016-05-12 17:12:58 7 7
I would like to update the value in RushType column same as ExpectedRushType column.
The rule is if the UserID in ('System','RECALL') then I need to update RushType value same as previous row rushType value which is UserID NOT in ('System','RECALL').
If there is no previous record then keep the same value as is.
NOTE (Table does't have ExpectedRushType colum. I just added to show what I am looking for) Table shows only one ID and ordered by DecisionTypeDetailDate
Any help greatly appreciated.