Ok - here is the SQL query:
SELECT
PRAE.EarnCode, PRAE.LimitOvrAmt,
PREA.PRCo, PREA.Mth, PREA.EDLType, PREA.EDLCode, PREA.Amount,
PREH.LastName, PREH.FirstName,
PREC.Description
FROM
{ oj ((Viewpoint.dbo.PRAE PRAE INNER JOIN Viewpoint.dbo.PREH PREH ON
PRAE.PRCo = PREH.PRCo AND
PRAE.Employee = PREH.Employee)
LEFT OUTER JOIN Viewpoint.dbo.PREA PREA ON
PRAE.PRCo = PREA.PRCo AND
PRAE.Employee = PREA.Employee AND
PRAE.EarnCode = PREA.EDLCode)
INNER JOIN Viewpoint.dbo.PREC PREC ON
PREA.PRCo = PREC.PRCo AND
PREA.EDLCode = PREC.EarnCode}
WHERE
PREA.PRCo = 1 AND
PREA.Mth >= {ts '2003-01-01 00:00:00.00'} AND
PREA.Mth < {ts '2003-05-01 00:00:01.00'} AND
PREA.EDLType = 'E' AND
PREA.EDLCode >= 70 AND
PREA.EDLCode <= 72 AND
PRAE.EarnCode >= 70 AND
PRAE.EarnCode <= 72
Here is the record selection:
{PREA.PRCo} = 1 and
{PREA.Mth} in DateTime (2003, 01, 01, 00, 00, 00) to DateTime (2003, 05, 01, 00, 00, 00) and
{PREA.EDLType} = "E" and
{PREA.EDLCode} in 70 to 72 and
{PRAE.EarnCode} in 70 to 72
PRAE is the table which has the limits. I want the report to show all employees in this table that have earnings codes of 70 - 72.
PREA is the table which has all of the amounts.
The other tables listed are just to clarify the report with actual employee names and earnings descriptions.
The report works except that it doesn't show employees from PRAE who don't yet have earnings with the codes 70 - 72 in PREA. I am trying to produce this report so I can tell an employee their balance for a particular earning.
The database I am reporting from comes from Bidtek (Viewpoint) - Microsoft SQL server.
Can you suggest a method that will accomplish what I need?
Thank you very much.