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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display Manaagers EMPLID for each employee

Status
Not open for further replies.

ttrsnoob

Technical User
Sep 8, 2008
13
0
0
US
I have a number of departments. In each department I have a manager. What I am looking for is a report to list each of the employees in that department with the managers ID after each employee.

This is what I am trying
(SELECT ("B"."EMPLID")
FROM "PS_JOB" "B"
WHERE ( ("B"."EMPLID"="PS_JOB"."EMPLID")
AND ("B"."EMPL_RCD_NBR"="PS_JOB"."EMPL_RCD_NBR")
AND ("B"."DEPTID"="PS_JOB"."DEPTID")
AND ("B"."JOBCODE"="PS_JOB"."JOBCODE")
AND ("PS_JOB"."JOBCODE"='12104')
AND ("PS_JOB"."EMPL_STATUS"='A') )
)

but when I try this nothing displays. (It does have the correct number of records but nothing shows on the report)
 
This sounds like a Data Exception to me. A Data Exception is invalid data in a field for example the letter A in a numeric field. I would try to narrow down the selection to make sure the report is ok otherwise. Then start looking for the bad data.

Specializing in ReportSmith Training and Consulting
 
Hi TTRSNOOB,

First, a couple questions... Are you putting this in a derived field? If so, there are two rules: 1. Put () around the SQL - looks like you did that, 2. Put a space in front of every line of the SQL - don't ask why, I just know it works.

Also, I typically will put select criteria first in the WHERE clause and the linking at the end. Only link on the key fields. In the JOB table, the key fields are EMPLID and EMPL_RCD_NBR. Here is your derived field:

(
SELECT (B.EMPLID)
FROM PS_JOB B
WHERE (PS_JOB.JOBCODE = '12104')
AND (PS_JOB.EMPL_STATUS = 'A')
AND (B.EMPLID = PS_JOB.EMPLID)
AND (B.EMPL_RCD_NBR = PS_JOB.EMPL_RCD_NBR)
)

If this is a formula in your Selection Criteria, I would approach this the same way, EXCEPT... you need to alter it a bit by turning it into an equation:

PS_JOB.EMPLID = (
SELECT (B.EMPLID)
FROM PS_JOB B
WHERE (PS_JOB.JOBCODE = '12104')
AND (PS_JOB.EMPL_STATUS = 'A')
AND (B.EMPLID = PS_JOB.EMPLID)
AND (B.EMPL_RCD_NBR = PS_JOB.EMPL_RCD_NBR)
)

Hope this helps! Good Luck!

RSGeek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top