psimonnyco
Programmer
Hello
I am running CRX. I have easily done a maximum(check_date, employee) calculation to pull an employee's latest check date. I did my group on EMPLOYEE and got one record per employee (although the employee has multiple checks).
The following is vexing me, though.
EMPLOYEE, PLAN_TYPE, PLAN_CODE, START_DATE
12345678, HEALTH, SIGNA1, 1/11/08
12345678, HEALTH, SIGNA1, 1/21/08
12345678, HEALTH, SIGNA1, 1/31/08
12345678, DENTAL, SIGNA2, 1/11/08
12345688, HEALTH, SIGNA1, 3/30/08
12345698, DENTAL, SIGNA2, 1/11/08
In this example, I want the following set returned:
12345678, HEALTH, SIGNA1, 1/31/08
12345678, DENTAL, SIGNA2, 1/11/08
12345688, HEALTH, SIGNA1, 3/30/08
12345698, DENTAL, SIGNA2, 1/11/08
I want to pull only the latest enrollment per employee (max of start date) by plan code. I don't see how I can use the Maximum function, as I'm basing my caculation on more than one field (unlike my first example above). I can do this in Access very easily in one simple query:
SELECT BENEFIT.EMPLOYEE, BENEFIT.PLAN_TYPE, BENEFIT.PLAN_CODE, Max(BENEFIT.START_DATE) AS MaxOfSTART_DATE
FROM BENEFIT
GROUP BY BENEFIT.EMPLOYEE, BENEFIT.PLAN_TYPE, BENEFIT.PLAN_CODE
ORDER BY BENEFIT.EMPLOYEE;
Any ideas? Possible concatenation?
Thanks.
I am running CRX. I have easily done a maximum(check_date, employee) calculation to pull an employee's latest check date. I did my group on EMPLOYEE and got one record per employee (although the employee has multiple checks).
The following is vexing me, though.
EMPLOYEE, PLAN_TYPE, PLAN_CODE, START_DATE
12345678, HEALTH, SIGNA1, 1/11/08
12345678, HEALTH, SIGNA1, 1/21/08
12345678, HEALTH, SIGNA1, 1/31/08
12345678, DENTAL, SIGNA2, 1/11/08
12345688, HEALTH, SIGNA1, 3/30/08
12345698, DENTAL, SIGNA2, 1/11/08
In this example, I want the following set returned:
12345678, HEALTH, SIGNA1, 1/31/08
12345678, DENTAL, SIGNA2, 1/11/08
12345688, HEALTH, SIGNA1, 3/30/08
12345698, DENTAL, SIGNA2, 1/11/08
I want to pull only the latest enrollment per employee (max of start date) by plan code. I don't see how I can use the Maximum function, as I'm basing my caculation on more than one field (unlike my first example above). I can do this in Access very easily in one simple query:
SELECT BENEFIT.EMPLOYEE, BENEFIT.PLAN_TYPE, BENEFIT.PLAN_CODE, Max(BENEFIT.START_DATE) AS MaxOfSTART_DATE
FROM BENEFIT
GROUP BY BENEFIT.EMPLOYEE, BENEFIT.PLAN_TYPE, BENEFIT.PLAN_CODE
ORDER BY BENEFIT.EMPLOYEE;
Any ideas? Possible concatenation?
Thanks.