|  |  | 
|  |  | Archives of the TeradataForumMessage Posted: Wed, 27 Jun 2013 @ 00:38:59 GMT
 
 Jerry, Without spending much time on this or knowing the table structure, I can only suggest looking at the Ordered Analytical Functions for a possible solution. Something like: 
     (D_date - MAX(A_date) over (partition by patient order by A_date rows
     between 1 preceding and 1 preceding)
Regards, Jim 
 | ||||||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||
|   | ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||