Let me start be giving the problem.
We are a health company ad we have member that sign on with specific effective date and we are having a problem getting information for these members.
Following are three difference issues which I have already resolved the first two but am not able to anwser the third.
1> An exsiting member disenrolles and reenrolles a month later. That is straight forward I can just get the new record.
Example:
Member Effective dates
John Doe 1/1/2003 - 1/31/2003
John Doe 3/1/2003 -
2. An exsiting member changes a benefit while being enrolled. This is a small problem becuase our system only will allow us to add a new effective date for that member and that will add a new record for him but his effective date is still his prior one. I resolved this problem with a datediff query that allows me to get that allows me to get the member with his first effective date.
Example:
Member Effective dates
John Doe 1/1/2003 - 1/31/2003
2/1/2003 -
I fixed problems 1 & 2 with this query:
effectiveDateStart =
Case when datediff (dd, Min(date_to), max(date_from)) = '1' then
cast(cast(year (min(date_from))as char(4))+
right(cast(month(min(date_from))+100 as char(3)),2)+
right(cast(day(min(date_from))+100 as char(3)),2) as char(8))
else
cast(cast(year (max(date_from)) as char(4))+
right(cast(month(max(date_from))+100 as char(3)),2)+
right(cast(day(max(date_from))+100 as char(3)),2) as char(8))
end,
That Query will give me the right effective dates for the member.
3. THIS IS MY PROBLEM: If the member something in his information again while still being enrolled. That will give me three records for him and the query above will not work becuase it is looking for the max and min effective dates.
So my question is, Is there a way to look at the difference between the the last two records for each member or can I only look at the min and the max?
Thanks for any help you guys can give.
rute67
We are a health company ad we have member that sign on with specific effective date and we are having a problem getting information for these members.
Following are three difference issues which I have already resolved the first two but am not able to anwser the third.
1> An exsiting member disenrolles and reenrolles a month later. That is straight forward I can just get the new record.
Example:
Member Effective dates
John Doe 1/1/2003 - 1/31/2003
John Doe 3/1/2003 -
2. An exsiting member changes a benefit while being enrolled. This is a small problem becuase our system only will allow us to add a new effective date for that member and that will add a new record for him but his effective date is still his prior one. I resolved this problem with a datediff query that allows me to get that allows me to get the member with his first effective date.
Example:
Member Effective dates
John Doe 1/1/2003 - 1/31/2003
2/1/2003 -
I fixed problems 1 & 2 with this query:
effectiveDateStart =
Case when datediff (dd, Min(date_to), max(date_from)) = '1' then
cast(cast(year (min(date_from))as char(4))+
right(cast(month(min(date_from))+100 as char(3)),2)+
right(cast(day(min(date_from))+100 as char(3)),2) as char(8))
else
cast(cast(year (max(date_from)) as char(4))+
right(cast(month(max(date_from))+100 as char(3)),2)+
right(cast(day(max(date_from))+100 as char(3)),2) as char(8))
end,
That Query will give me the right effective dates for the member.
3. THIS IS MY PROBLEM: If the member something in his information again while still being enrolled. That will give me three records for him and the query above will not work becuase it is looking for the max and min effective dates.
So my question is, Is there a way to look at the difference between the the last two records for each member or can I only look at the min and the max?
Thanks for any help you guys can give.
rute67