I have 2 tables:
Claims table- claim ID, Member_ID, service_from_da te, service_end_dat e.
Plan table- Member_ID, Plan_ID, Plan_from_date, Plan_end_date. The same member_id can have multiple Plan_ID with different dates.
I need to assign the Plan_ID to each claim ID. The criteria is that the service_from_da te has to be greater than or equal the Plan_start_date and equal or lower than the Plan_end_date. For claims that are left without the Plan ID, because they are out of range, assign the Plan_ID with Plan_from_date that is lower and closer to the service_from_da te.
Claims table- claim ID, Member_ID, service_from_da te, service_end_dat e.
Plan table- Member_ID, Plan_ID, Plan_from_date, Plan_end_date. The same member_id can have multiple Plan_ID with different dates.
I need to assign the Plan_ID to each claim ID. The criteria is that the service_from_da te has to be greater than or equal the Plan_start_date and equal or lower than the Plan_end_date. For claims that are left without the Plan ID, because they are out of range, assign the Plan_ID with Plan_from_date that is lower and closer to the service_from_da te.
Comment