I have the following SQL which contains an Alias table that is LEFT Joined.
The report appears to be pulling the correct data in Crystal, but I get a DLL error when trying to export to excel. The row count is fairly large, could that be causing the issue? Also, I not sure if my approach to the SQL is correct. When I try and remove the LEFT join I loose records, but the report then exports without an error.
Any help is greatly apprecited.
FROM
CheckSummHE
INNER JOIN CheckSumm ON CheckSummHE.CseFlxIDCsu = CheckSumm.CsuFlxID
INNER JOIN EBase ON CheckSumm.CsuFlxIDEb = EBase.EbFlxID
INNER JOIN EEmploy ON EBase.EbFlxID = EEmploy.EEFlxIDEb
INNER JOIN EPerson ON EBase.EbFlxID = EPerson.EPFlxIDEb
INNER JOIN EJob ON EBase.EbFlxID = EJob.EjFlxIDEb
LEFT JOIN EJob as EjobOLD ON EBase.EbFlxID = EJobOLD.EJFlxIDEb and EJobOLD.EJDateEnd = EJob.EJDateBeg - 1
WHERE
EBase.EbFlagEmp = 'Y' AND
(EEmploy.EEstatus <> 'Terminated' AND
EEMPLOY.EEdatebeg = (SELECT MAX (EE.EEDATEBEG)
FROM EEMPLOY AS EE WHERE EBASE.EBFLXID=EE.EEFLXIDEB) AND
ejob.ejdatebeg = (SELECT MAX (JOB.EJDATEBEG)
FROM EJOB AS JOB WHERE EBASE.EBFLXID=JOB.EJFLXIDEB) AND
Eperson.EPdatebeg = (SELECT MAX (PERSON.EPDATEBEG)
FROM EPerson AS PERSON WHERE EBASE.EBFLXID=PERSON.EPFLXIDEB)
OR
EEmploy.EEStatus = 'Terminated' AND
EEMPLOY.EEdatebeg = (SELECT MAX (EE.EEDATEBEG)
FROM EEMPLOY AS EE WHERE EBASE.EBFLXID=EE.EEFLXIDEB) AND
Eperson.EPdatebeg = (SELECT MAX (PERSON.EPDATEBEG)
FROM EPerson AS PERSON WHERE EBASE.EBFLXID=PERSON.EPFLXIDEB) and
ejob.ejdatebeg = (SELECT MAX (JOB.EJDATEBEG)
FROM EJOB AS JOB WHERE EBASE.EBFLXID=JOB.EJFLXIDEB) AND
EEmploy.eetermdate >= '01/01/2010' and
EJob.EjDateEnd >= EEmploy.EETermDate) and
CheckSumm.CsuDateBeg >= {ts '2009-01-01 00:00:00.00'} AND CheckSumm.CsuDateBeg <= {ts '2010-12-31 23:59:59.00'}
Thanks,
Dawn