Assigning value in Field "A" Record "X" to Field "B" Record "Y"
Hi there,
I hope the title does justice in explaining what I am trying to do. I have a table that contains the fields policynum, transreason, policyeffdate, and transdate. "Transreason" indicates whether or not there was a transaction on a policy (policynum). If there was a transaction then a "transdate" is available. A policy can have multiple transactions and transaction dates. Ultimately what I want to do is find the number of days between each transaction. For the first transaction, I want the days inbetween the policyeffdate and the transdate, for the second transdate the days inbetween the first transdate and second transdate, etc....
Any suggestions? I'm trying to do this with a module function similar to a counting function. It's tricky with the dates though, especially since some policies have just 1 transdate and others have more than 1. Here's some sample data:
PolicyNum PolicyEffDate TransDate TransReason
10029 8/1/2004 1/3/2005 EUH
10029 8/1/2004 5/25/2005 EUI
10053 1/31/2004 6/23/2004 EUI
10053 1/31/2004 12/31/2004 ELUH
10065 3/1/2004 3/10/2004 EVUI
10162 3/15/2004 8/17/2004 ELUH
10162 3/15/2004 8/31/2004 EUI
10166 5/27/2004 10/15/2004 UI
Hi there,
I hope the title does justice in explaining what I am trying to do. I have a table that contains the fields policynum, transreason, policyeffdate, and transdate. "Transreason" indicates whether or not there was a transaction on a policy (policynum). If there was a transaction then a "transdate" is available. A policy can have multiple transactions and transaction dates. Ultimately what I want to do is find the number of days between each transaction. For the first transaction, I want the days inbetween the policyeffdate and the transdate, for the second transdate the days inbetween the first transdate and second transdate, etc....
Any suggestions? I'm trying to do this with a module function similar to a counting function. It's tricky with the dates though, especially since some policies have just 1 transdate and others have more than 1. Here's some sample data:
PolicyNum PolicyEffDate TransDate TransReason
10029 8/1/2004 1/3/2005 EUH
10029 8/1/2004 5/25/2005 EUI
10053 1/31/2004 6/23/2004 EUI
10053 1/31/2004 12/31/2004 ELUH
10065 3/1/2004 3/10/2004 EVUI
10162 3/15/2004 8/17/2004 ELUH
10162 3/15/2004 8/31/2004 EUI
10166 5/27/2004 10/15/2004 UI