Hello all;
I'm using ADP Enterprise, Reportsmith 4.0 – SQL and trying to upgrade a report that pulls an employee's previous row of Full or Part Time status.
I'm using this derived field for the "OLD" and it works just fine:
(SELECT OLD_[[FT_PT]].[[FT_PT]]
FROM
PS_JOB OLD_[[FT_PT]]
WHERE
((OLD_[[FT_PT]].EMPLID = JOB.EMPLID)
AND
(OLD_[[FT_PT]].EMPL_RCD_NBR = JOB.EMPL_RCD_NBR)
AND
(OLD_[[FT_PT]].EFFSEQ=
(SELECT MAX(INNERALIAS.EFFSEQ)
FROM PS_JOB INNERALIAS
WHERE INNERALIAS.EMPLID = OLD_[[FT_PT]].EMPLID
AND INNERALIAS.EMPL_RCD_NBR = OLD_[[FT_PT]].EMPL_RCD_NBR
AND INNERALIAS.EFFDT = OLD_[[FT_PT]].EFFDT)
AND
OLD_[[FT_PT]].EFFDT =
(SELECT MAX(INNERALIAS.EFFDT)
FROM PS_JOB INNERALIAS
WHERE INNERALIAS.EMPLID = OLD_[[FT_PT]].EMPLID
AND INNERALIAS.EMPL_RCD_NBR = OLD_[[FT_PT]].EMPL_RCD_NBR
AND INNERALIAS.EFFDT < (SELECT MAX(JOB.EFFDT))
AND OLD_[[FT_PT]].[[FT_PT]] = "P"
))))
)
The problem I run into is trying to get the report to ONLY pull the Previous PartTimers. I've confirmed that my table links do NOT "include Unmatched".
When I try to add the selection under the main Select List, I get:
"An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference."
When I try to add the selection under the DataBase Grouping, I get:
"An aggregated expression containing an outer reference must be contained in either the select list, or a HAVING clause subquery in the query whose FROM clause contains the table with the column being aggregated."
Normally when I get these type of messages, I try different variations of turning database grouping off & on, being sure my fields are included or excluded from database grouping correctly, etc. None of my normal troubleshooting ideas are working today.
Any other ideas? As always, appreciate any help - ThX !
I'm using ADP Enterprise, Reportsmith 4.0 – SQL and trying to upgrade a report that pulls an employee's previous row of Full or Part Time status.
I'm using this derived field for the "OLD" and it works just fine:
(SELECT OLD_[[FT_PT]].[[FT_PT]]
FROM
PS_JOB OLD_[[FT_PT]]
WHERE
((OLD_[[FT_PT]].EMPLID = JOB.EMPLID)
AND
(OLD_[[FT_PT]].EMPL_RCD_NBR = JOB.EMPL_RCD_NBR)
AND
(OLD_[[FT_PT]].EFFSEQ=
(SELECT MAX(INNERALIAS.EFFSEQ)
FROM PS_JOB INNERALIAS
WHERE INNERALIAS.EMPLID = OLD_[[FT_PT]].EMPLID
AND INNERALIAS.EMPL_RCD_NBR = OLD_[[FT_PT]].EMPL_RCD_NBR
AND INNERALIAS.EFFDT = OLD_[[FT_PT]].EFFDT)
AND
OLD_[[FT_PT]].EFFDT =
(SELECT MAX(INNERALIAS.EFFDT)
FROM PS_JOB INNERALIAS
WHERE INNERALIAS.EMPLID = OLD_[[FT_PT]].EMPLID
AND INNERALIAS.EMPL_RCD_NBR = OLD_[[FT_PT]].EMPL_RCD_NBR
AND INNERALIAS.EFFDT < (SELECT MAX(JOB.EFFDT))
AND OLD_[[FT_PT]].[[FT_PT]] = "P"
))))
)
The problem I run into is trying to get the report to ONLY pull the Previous PartTimers. I've confirmed that my table links do NOT "include Unmatched".
When I try to add the selection under the main Select List, I get:
"An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference."
When I try to add the selection under the DataBase Grouping, I get:
"An aggregated expression containing an outer reference must be contained in either the select list, or a HAVING clause subquery in the query whose FROM clause contains the table with the column being aggregated."
Normally when I get these type of messages, I try different variations of turning database grouping off & on, being sure my fields are included or excluded from database grouping correctly, etc. None of my normal troubleshooting ideas are working today.
Any other ideas? As always, appreciate any help - ThX !