RE:[peopletools-l] Max Completion Date

Reply from donbarclay on Jan 3 at 5:18 PM
Did you really mean for the first bind variable (:1) to be used for CI_ID and LM_CRSE_CODE? Usually, the error that you are receiving means that something that is not a number is being interpreted as a number. Maybe CI_ID is a number field, and LM_CRSE_CODE is a character field? Check your binds at the end.

---------------Original Message---------------
From: malmoula
Sent: Thursday, December 29, 2011 2:47 PM
Subject: Max Completion Date

Working on modifying a query in PS/ELM Query Manager

This report is for a specific course and lists out all employees who completed the course in a defined date range.
We would like the query to display only one record per employee, where the employee has taken / completed the course 3 times between the dates.
The last / most current completion date should be included and not the other 2 dates.

For example if am running the query for course XYZ and Emp A has taken the course 3 times this year - 02/01/2011, 06/01/2011 and 11/01/2011, we would like to show only the 11/01/2011 row.


Anyone has any ideas to make it work?

Here is the Query SQL:

SELECT F.LM_HR_EMPLID, G.NAME, A.LM_HR_EMPLID, B.NAME, C.LM_PER_ORG, D.LM_STTS, TO_CHAR(D.LM_ENRL_DT,'YYYY-MM-DD'), TO_CHAR(D.LM_COMPL_DT,'YYYY-MM-DD'), E.LM_CS_LONG_NM, E.LM_CRSE_CODE, TO_CHAR(SYSDATE,'YYYY-MM-DD'),E.LM_CI_ID,TO_CHAR(E.EFFDT,'YYYY-MM-DD')
FROM PS_LM_PERSON A, PS_LM_PERSON_NAME B, PS_LM_PERSON_ATTRB C, PS_LM_ENRLMT D, PS_LM_CI_TBL E, PS_LM_PERSON F, PS_LM_PERSON_NAME G
WHERE A.LM_PERSON_ID = B.LM_PERSON_ID
AND B.EFFDT =
(SELECT MAX(B_ED.EFFDT) FROM PS_LM_PERSON_NAME B_ED
WHERE B.LM_PERSON_ID = B_ED.LM_PERSON_ID
AND B.LM_NAME_TYPE = B_ED.LM_NAME_TYPE
AND B_ED.EFFDT <= SYSDATE)
AND B.LM_PERSON_ID = C.LM_PERSON_ID
AND C.EFFDT =
(SELECT MAX(C_ED.EFFDT) FROM PS_LM_PERSON_ATTRB C_ED
WHERE C.LM_PERSON_ID = C_ED.LM_PERSON_ID
AND C.LM_EMPL_RCD = C_ED.LM_EMPL_RCD
AND C_ED.EFFDT <= SYSDATE)
AND C.LM_PERSON_ID = D.LM_PERSON_ID
AND C.LM_EMPL_RCD = D.LM_EMPL_RCD
AND E.LM_CI_ID = D.LM_CI_ID
AND E.EFFDT =
(SELECT MAX(E_ED.EFFDT) FROM PS_LM_CI_TBL E_ED
WHERE E.LM_CI_ID = E_ED.LM_CI_ID
AND E_ED.EFFDT <= SYSDATE)
AND F.LM_PERSON_ID = C.LM_MANAGER_ID
AND F.LM_PERSON_ID = G.LM_PERSON_ID
AND G.EFFDT =
(SELECT MAX(G_ED.EFFDT) FROM PS_LM_PERSON_NAME G_ED
WHERE G.LM_PERSON_ID = G_ED.LM_PERSON_ID
AND G.LM_NAME_TYPE = G_ED.LM_NAME_TYPE
AND G_ED.EFFDT <= SYSDATE)
AND D.LM_COMPL_DT BETWEEN TO_DATE(:2,'YYYY-MM-DD') AND TO_DATE(:3,'YYYY-MM-DD')
AND E.LM_CRSE_CODE = :1
AND D.LM_COMPL_DT = (SELECT MAX( I.LM_COMPL_DT)
FROM PS_LM_ENRLMT I
HAVING COUNT( I.LM_ACT_ID) > 1)
ORDER BY 2, 3, 8

Thanks a lot for your time.

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2012 Toolbox.com and message author.
Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
donbarclay  
Lead PeopleSoft Developer
achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Toolbox.com for iPhone & Android: Ask Questions & Get Answers Anywhere. Download the Free App

_.____.__

No comments:

Post a Comment