Hi,
I am trying to identify when a patient(PAT_MRN_ID) first was assigned to a Provider(PROV_NAME) by date(EFF_DATE). Most patients have changed providers over and over, so I want to know who the first provider was assigned to a specific patient based on the date(EFF_DATE).
I have tried using 'First' or "min" in the EFF_DATE field, but I keep getting all records.
DATA SAMPLE:
PAT_NAME PAT_ID PCP PROV_NAME EFF_DATE TERM_DATE
TEST, CUSTOMER 111111 1234 JONES, DAVID 28-AUG-02 03-DEC-07
TEST, CUSTOMER 111111 5678 DOE, JANE 04-DEC-07 18-MAR-09
TEST, CUSTOMER 111111 10 NO PCP 19-MAR-09 15-SEP-10
TEST, CUSTOMER 111111 5678 DOE, JANE 16-SEP-10 22-JUN-11
I want to be able to just get the record with the oldest EFF_DATE.