Hi all,
I am in a bind with a query qryDuplicateITVMatchesCorrectedUS:
This query returns records from two queries(qryUnMatchedUSGLDATA - I'll refer to this as qry1, qryDuplicateITVMatchesUS - I'll refer to this as qry2) where five fields in each table match:
Entry = Entry
Lupdtdte = USLupdtdte
Acct = BudgetCode
Obj = ObjectCode
Amt = Amt
When the query runs it returns records like this:
Is there a way to rewrite the query listed above so that the records returned are not duplicated multiple times? The data should look like this:
If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
I am in a bind with a query qryDuplicateITVMatchesCorrectedUS:
Code:
SELECT qryDuplicateITVMatchesUS.ITandVoucherID, qryDuplicateITVMatchesUS.Entry, qryUnMatchedUSGLData.Entry, qryDuplicateITVMatchesUS.GLSLine_No, qryUnMatchedUSGLData.Line_No, qryDuplicateITVMatchesUS.GLSLupdtdte, qryUnMatchedUSGLData.Lupdtdte, qryDuplicateITVMatchesUS.BudgetCode, qryUnMatchedUSGLData.Acct, qryDuplicateITVMatchesUS.ObjectCode, qryUnMatchedUSGLData.Obj, qryDuplicateITVMatchesUS.Amount, qryUnMatchedUSGLData.Amt
FROM qryUnMatchedUSGLData INNER JOIN qryDuplicateITVMatchesUS ON (qryUnMatchedUSGLData.Amt = qryDuplicateITVMatchesUS.Amount) AND (qryUnMatchedUSGLData.Obj = qryDuplicateITVMatchesUS.ObjectCode) AND (qryUnMatchedUSGLData.Acct = qryDuplicateITVMatchesUS.BudgetCode) AND (qryUnMatchedUSGLData.Lupdtdte = qryDuplicateITVMatchesUS.GLSLupdtdte) AND (qryUnMatchedUSGLData.Entry = qryDuplicateITVMatchesUS.Entry);
This query returns records from two queries(qryUnMatchedUSGLDATA - I'll refer to this as qry1, qryDuplicateITVMatchesUS - I'll refer to this as qry2) where five fields in each table match:
Entry = Entry
Lupdtdte = USLupdtdte
Acct = BudgetCode
Obj = ObjectCode
Amt = Amt
When the query runs it returns records like this:
Code:
ITandVoucherID qry1.Entry qry2.Entry GLSLine_No Line_No
34774 83750 83750 1 9
34774 83750 83750 1 41
34774 83750 83750 1 27
34774 83750 83750 1 3
34774 83750 83750 1 33
34774 83750 83750 1 21
34780 83750 83750 1 41
34780 83750 83750 1 27
34780 83750 83750 1 21
34780 83750 83750 1 33
34780 83750 83750 1 9
34780 83750 83750 1 3
34785 83750 83750 7 14
34787 83750 83750 7 14
34792 83750 83750 1 9
34792 83750 83750 1 27
34792 83750 83750 1 33
34792 83750 83750 1 21
34792 83750 83750 1 3
34792 83750 83750 1 41
34798 83750 83750 1 41
34798 83750 83750 1 33
34798 83750 83750 1 3
34798 83750 83750 1 21
34798 83750 83750 1 27
34798 83750 83750 1 9
34804 83750 83750 1 3
34804 83750 83750 1 9
34804 83750 83750 1 27
34804 83750 83750 1 33
34804 83750 83750 1 21
34804 83750 83750 1 41
34807 83750 83750 34 37
34808 83750 83750 34 37
34811 83750 83750 1 21
34811 83750 83750 1 33
34811 83750 83750 1 27
34811 83750 83750 1 9
34811 83750 83750 1 41
34811 83750 83750 1 3
34812 83750 83750 1 33
34812 83750 83750 1 3
34812 83750 83750 1 9
34812 83750 83750 1 41
34812 83750 83750 1 27
34812 83750 83750 1 21
35102 86946 86946 3 16
35102 86946 86946 3 18
35102 86946 86946 3 14
35102 86946 86946 3 8
35102 86946 86946 3 21
35108 86946 86946 3 21
35108 86946 86946 3 18
35108 86946 86946 3 16
35108 86946 86946 3 8
35108 86946 86946 3 14
35110 86946 86946 3 21
35110 86946 86946 3 18
35110 86946 86946 3 8
35110 86946 86946 3 14
35110 86946 86946 3 16
35112 86946 86946 3 21
35112 86946 86946 3 8
35112 86946 86946 3 16
35112 86946 86946 3 18
35112 86946 86946 3 14
35115 86946 86946 3 21
35115 86946 86946 3 8
35115 86946 86946 3 14
35115 86946 86946 3 16
35115 86946 86946 3 18
35121 86946 86946 3 8
35121 86946 86946 3 21
35121 86946 86946 3 14
35121 86946 86946 3 16
35121 86946 86946 3 18
35479 93104 93104 3 4
35479 93104 93104 3 14
35488 93104 93104 3 14
35488 93104 93104 3 4
35491 93104 93104 16 17
35496 93104 93104 3 14
35496 93104 93104 3 4
35506 93104 93104 16 17
Is there a way to rewrite the query listed above so that the records returned are not duplicated multiple times? The data should look like this:
Code:
ITandVoucherID qry1.Entry qry2.Entry GLSLine_No Line_No
34774 83750 83750 1 3
34780 83750 83750 1 9
34787 83750 83750 7 14
34792 83750 83750 1 21
34798 83750 83750 1 27
34804 83750 83750 1 33
34808 83750 83750 34 37
34811 83750 83750 1 41
35102 86946 86946 3 8
35108 86946 86946 3 14
35110 86946 86946 3 16
35112 86946 86946 3 18
35115 86946 86946 3 21
35479 93104 93104 3 4
35488 93104 93104 3 14
35506 93104 93104 16 17
If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations