M
martinmike2
Hello,
I have a Union Query:
SELECT DISTINCTROW EDVR.A_RATE_ABR, EDVR.DNEC1, EDVR.DNEC2, EDVR.UIC,
qryAMDsubqry.*
FROM EDVR RIGHT JOIN qryAMDsubqry ON EDVR.SSN = qryAMDsubqry.SSN
UNION SELECT DISTINCTROW tblOCDR.RANK, tblOCDR.DESIG,
tblOCDR.PAYGRADE, tblOCDR.UIC, qryOAMDsubqry.*
FROM tblOCDR RIGHT JOIN qryOAMDsubqry ON tblOCDR.SSN =
qryOAMDsubqry.SSN;
qryAMDsubqry:
SELECT tblDIV.WC, tblDIV.TITLE, PERS.[NAME LAST], PERS.[NAME FIRST],
tblAMD.auic, tblAMD.bin, tblAMD.bsc, tblAMD.r_rtabbr, tblAMD.r_pnec,
tblAMD.r_snec, tblAMD.title, PERS.SSN, tblAMD.a_rtabbr, PERS.WCNTR
FROM tblDIV INNER JOIN (tblAMD LEFT JOIN PERS ON tblAMD.SSN =
PERS.SSN) ON tblDIV.WCCODE = tblAMD.WCCODE
WHERE (((tblAMD.auic) Like [Which UIC?]) AND ((tblAMD.WCCODE) Is Not
Null));
qryOAMDsubqry:
SELECT tblDIV.WC, tblDIV.TITLE, O_PERS.[NAME LAST], O_PERS.[NAME
FIRST], tblAMD.auic, tblAMD.bin, tblAMD.bsc, tblAMD.r_rtabbr,
tblAMD.r_pnec, tblAMD.r_snec, tblAMD.title, O_PERS.SSN,
tblAMD.a_rtabbr, O_PERS.WC
FROM tblDIV INNER JOIN (tblAMD INNER JOIN O_PERS ON tblAMD.SSN =
O_PERS.SSN) ON tblDIV.WCCODE = tblAMD.WCCODE
WHERE (((O_PERS.[NAME LAST]) Is Not Null) AND ((tblAMD.auic) Like
[Which UIC?]) AND ((tblAMD.WCCODE) Is Not Null));
The problem I am having is that for every record in tblAMD where the
SSN field is in O_PERS and not in PERS I am getting a duplicate record
shown on a report. While I confess I am not really SQL savvy I know
enough to get by, but this is killing me, lol. I can't have
duplicated records shown on the report as this is our master manning
document that shows where everybody is at and the job title they hold.
I have a Union Query:
SELECT DISTINCTROW EDVR.A_RATE_ABR, EDVR.DNEC1, EDVR.DNEC2, EDVR.UIC,
qryAMDsubqry.*
FROM EDVR RIGHT JOIN qryAMDsubqry ON EDVR.SSN = qryAMDsubqry.SSN
UNION SELECT DISTINCTROW tblOCDR.RANK, tblOCDR.DESIG,
tblOCDR.PAYGRADE, tblOCDR.UIC, qryOAMDsubqry.*
FROM tblOCDR RIGHT JOIN qryOAMDsubqry ON tblOCDR.SSN =
qryOAMDsubqry.SSN;
qryAMDsubqry:
SELECT tblDIV.WC, tblDIV.TITLE, PERS.[NAME LAST], PERS.[NAME FIRST],
tblAMD.auic, tblAMD.bin, tblAMD.bsc, tblAMD.r_rtabbr, tblAMD.r_pnec,
tblAMD.r_snec, tblAMD.title, PERS.SSN, tblAMD.a_rtabbr, PERS.WCNTR
FROM tblDIV INNER JOIN (tblAMD LEFT JOIN PERS ON tblAMD.SSN =
PERS.SSN) ON tblDIV.WCCODE = tblAMD.WCCODE
WHERE (((tblAMD.auic) Like [Which UIC?]) AND ((tblAMD.WCCODE) Is Not
Null));
qryOAMDsubqry:
SELECT tblDIV.WC, tblDIV.TITLE, O_PERS.[NAME LAST], O_PERS.[NAME
FIRST], tblAMD.auic, tblAMD.bin, tblAMD.bsc, tblAMD.r_rtabbr,
tblAMD.r_pnec, tblAMD.r_snec, tblAMD.title, O_PERS.SSN,
tblAMD.a_rtabbr, O_PERS.WC
FROM tblDIV INNER JOIN (tblAMD INNER JOIN O_PERS ON tblAMD.SSN =
O_PERS.SSN) ON tblDIV.WCCODE = tblAMD.WCCODE
WHERE (((O_PERS.[NAME LAST]) Is Not Null) AND ((tblAMD.auic) Like
[Which UIC?]) AND ((tblAMD.WCCODE) Is Not Null));
The problem I am having is that for every record in tblAMD where the
SSN field is in O_PERS and not in PERS I am getting a duplicate record
shown on a report. While I confess I am not really SQL savvy I know
enough to get by, but this is killing me, lol. I can't have
duplicated records shown on the report as this is our master manning
document that shows where everybody is at and the job title they hold.