I'm sure the problem with this SQL goes deeper than syntax error. This worked great before I tried to add email addresses to my results.
Syntax error on line 13 and 23:
(SELECT
a.EMPLID,
a.EMPL_RCD,
a.EMPL_STATUS,
a.HR_STATUS,
a.EFFSEQ,
a.ACTION,
(CONVERT(CHAR(10),a.[EFFDT],110)) AS EFF_DATE,
c.[EMAIL_ADDR]
FROM
[JOB] a, [EMAIL_ADDRESSES] c
WHERE
a.[EMPLID] = c.[EMPLID]) d
INNER JOIN
(SELECT
[PS_JOB].[EMPLID],
MIN([PS_JOB].[EMPL_RCD]) AS MIN_EMPL_RCD,
MAX([PS_JOB].[EFFSEQ]) AS MAX_EFF_SEQ,
MAX([PS_JOB].[EFFDT]) AS MAX_EFF_DATE
FROM
[JOB]
GROUP BY
[JOB].[EMPLID]) b
ON
d.[EMPLID] = b.[EMPLID]
AND d.[EFFDT] = b.MAX_EFF_DATE
AND d.[EFFSEQ] = b.MAX_EFF_SEQ
AND d.[EMPL_RCD] = b.MIN_EMPL_RCD
AND d.[EMPL_STATUS] = 'A'
AND d.[HR_STATUS] = 'A'
Syntax error on line 13 and 23:
(SELECT
a.EMPLID,
a.EMPL_RCD,
a.EMPL_STATUS,
a.HR_STATUS,
a.EFFSEQ,
a.ACTION,
(CONVERT(CHAR(10),a.[EFFDT],110)) AS EFF_DATE,
c.[EMAIL_ADDR]
FROM
[JOB] a, [EMAIL_ADDRESSES] c
WHERE
a.[EMPLID] = c.[EMPLID]) d
INNER JOIN
(SELECT
[PS_JOB].[EMPLID],
MIN([PS_JOB].[EMPL_RCD]) AS MIN_EMPL_RCD,
MAX([PS_JOB].[EFFSEQ]) AS MAX_EFF_SEQ,
MAX([PS_JOB].[EFFDT]) AS MAX_EFF_DATE
FROM
[JOB]
GROUP BY
[JOB].[EMPLID]) b
ON
d.[EMPLID] = b.[EMPLID]
AND d.[EFFDT] = b.MAX_EFF_DATE
AND d.[EFFSEQ] = b.MAX_EFF_SEQ
AND d.[EMPL_RCD] = b.MIN_EMPL_RCD
AND d.[EMPL_STATUS] = 'A'
AND d.[HR_STATUS] = 'A'