Good morning everyone,
I need help with creating a query with two tables. Table A contains multiple records with the same ID number and SERVICE DATES (Some service date may not contain a date [BLANK]). Table B contains multiple records with the same ID and STATUS DATES and a STATUS FLAG that indicates if the record was eligible or ineligible for service (“E” = Eligible and “I” = Ineligible).
An Example is TABLE B has multiple records with the same ID number and if a STATUS FLAG is “E” and the STATUS DATE is 12/13/2013 and the same ID number has another STATUS FLAG and this time is “I” and the STATUS DATE is 2/1/2014 it means the record was Eligible from 12/13/2013 to 1/31/2014. Any SERVICE DATES between 12/13/2013 and 1/31/2014 are Eligible.
Another Example is TABLE B has multiple records with the same ID number and if a STATUS FLAG is “E” and the STATUS DATE is 12/13/2013 and the same ID number has another STATUS FLAG and this time it is “I” and the STATUS DATE is 2/1/2014 and then we have another STATUS FLAG and this time it is “E” and the STATUS DATE is 2/15/2014 it means the record was Eligible from 12/13/2013 to 1/31/2014 but Ineligible from 2/1/2014 to 2/14/2014 and then Eligible from 2/15/2014 to present.
There are records in Table A that may not appear in Table B, and there will be entries in Table B that don't appear in the Table A.
I would like to be able to use the SERVICE DATES found in Table A to reference the STATUS DATES and STATUS FLAG in Table B to determine is records in Table A were eligible or ineligible.
Example database is attached.
I need help with creating a query with two tables. Table A contains multiple records with the same ID number and SERVICE DATES (Some service date may not contain a date [BLANK]). Table B contains multiple records with the same ID and STATUS DATES and a STATUS FLAG that indicates if the record was eligible or ineligible for service (“E” = Eligible and “I” = Ineligible).
An Example is TABLE B has multiple records with the same ID number and if a STATUS FLAG is “E” and the STATUS DATE is 12/13/2013 and the same ID number has another STATUS FLAG and this time is “I” and the STATUS DATE is 2/1/2014 it means the record was Eligible from 12/13/2013 to 1/31/2014. Any SERVICE DATES between 12/13/2013 and 1/31/2014 are Eligible.
Another Example is TABLE B has multiple records with the same ID number and if a STATUS FLAG is “E” and the STATUS DATE is 12/13/2013 and the same ID number has another STATUS FLAG and this time it is “I” and the STATUS DATE is 2/1/2014 and then we have another STATUS FLAG and this time it is “E” and the STATUS DATE is 2/15/2014 it means the record was Eligible from 12/13/2013 to 1/31/2014 but Ineligible from 2/1/2014 to 2/14/2014 and then Eligible from 2/15/2014 to present.
There are records in Table A that may not appear in Table B, and there will be entries in Table B that don't appear in the Table A.
I would like to be able to use the SERVICE DATES found in Table A to reference the STATUS DATES and STATUS FLAG in Table B to determine is records in Table A were eligible or ineligible.
Example database is attached.