Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare earning code report

Status
Not open for further replies.

christimess

Programmer
May 26, 2004
33
US
I am trying to create a report where you select a check date and earning code and it will compare that information to the last check date and if that earning code is not there it will list that employee on the report.
We thought of doing this with a derived field. We created the following derived field:
(SELECT 'Y' FROM PS_AL_CHK_HRS_ERN B
WHERE B.EMPLID = "CHK"."EMPLID"
AND B.EMPL_RCD_NBR = "CHK"."EMPL_RCD_NBR"
AND B.ERNCD = "CHK"."ERNCD"
AND B.CHECK_DT = (
SELECT MAX(C.CHECK_DT)
FROM PS_AL_CHK_DATA C
WHERE C.EMPLID = "CHK"."EMPLID"
AND C.EMPL_RCD_NBR = "CHK"."EMPL_RCD_NBR"
AND C.CHECK_DT < "CHK"."CHECK_DT"))
However it is not working properly and is listing employees that should not be on the report.
The problem may be that when a sub-select statement is done within the ‘Select’ clause in the SQL Statement, is that it may cause issues when it returns more than one row.

Does anyone have any suggestions on how I can get this derived field to work?
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top