Insert Next Column Entry

Last Post 26 Sep 2007 03:04 AM by sgfubt321. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
sgfubt321
New Member
New Member

--
26 Sep 2007 03:04 AM
We have data in the following format:

c1 c2 c3 c4 c5 c6 c7
0000 562079 562079 ADMISSION OPT 30CD 123456
0000 562080 562079 SPECIALTY TRANSFER PROVIDER CHANGE NULL NULL
0000 562123 562079 SPECIALTY TRANSFER PROVIDER CHANGE NULL NULL
0000 562750 562079 DISCHARGE TO NHCU NULL NULL
0000 562751 562751 ADMISSION DIRECT 211AB 123459
0000 562752 562751 SPECIALTY TRANSFER PROVIDER CHANGE NULL NULL
0000 562864 562751 DISCHARGE REGULAR NULL NULL

The c2 column is the primary key. When we have the c3 number being the same and c4 has a DISCHARGE and c5 is listed as TO NHCU then we want to get the next entry in c6 and insert it into c6 column for the DISCHARGE row where it is currently NULL. The result we would like is the following:

c1 c2 c3 c4 c5 c6 c7
0000 562079 562079 ADMISSION OPT 30CD 123456
0000 562080 562079 SPECIALTY TRANSFER PROVIDER CHANGE NULL NULL
0000 562123 562079 SPECIALTY TRANSFER PROVIDER CHANGE NULL NULL
0000 562750 562079 DISCHARGE TO NHCU 211AB NULL
0000 562751 562751 ADMISSION DIRECT 211AB 123459
0000 562752 562751 SPECIALTY TRANSFER PROVIDER CHANGE NULL NULL
0000 562864 562751 DISCHARGE REGULAR NULL NULL

If anyone can be of assistance, we would greatly appreciate it. Thank you in advance...
You are not authorized to post a reply.

Acceptable Use Policy