Hi All,
I'm running Access 2016 with a SQL back end containing 2 tables CCR & DCR.
The query I have successfully pulls the data I need for a single day but when I need more than one day I can't figure out how to Sum the Distinct Values in the DCR table. The main issue I believe is while the CCR table will have multiple values for a particular day the DCR table will only have one value per day and the query displays it multiple times.
Here is what my query look like...
Here are a sample of my results...
Trans Date|OFFICE CODE|SUMOfEDL Retention|Adj DMV/s Tax Total
3/1/2017 | BUF | $27.00 | $3,278.69
3/1/2017 | BUF | $18.00 | $3,278.69
3/1/2017 | BUF | $9.00 | $3,278.69
3/2/2017 | BUF | $27.00 | $2,657.18
3/2/2017 | BUF | $18.00 | $2,657.18
3/2/2017 | BUF | $18.00 | $2,657.18
So I need the Sum of the [SUMOfEDL Retention] column but only the distinct value sum of the [Adj DMV/s Tax Total] in the right column...I'm looking to display this in a access report and the results should be $117.00 & $5,935.87.
I hope this was through and clear...
Thank you for your time
Tom
I'm running Access 2016 with a SQL back end containing 2 tables CCR & DCR.
The query I have successfully pulls the data I need for a single day but when I need more than one day I can't figure out how to Sum the Distinct Values in the DCR table. The main issue I believe is while the CCR table will have multiple values for a particular day the DCR table will only have one value per day and the query displays it multiple times.
Here is what my query look like...
Code:
SELECT dbo_CCR.[Trans Date], dbo_CCR.[OFFICE CODE], Sum(dbo_CCR.[EDL Retention]) AS [SumOfEDL Retention], Sum(([Retention Fee]+[Fee Backup]+[Fee Manual])+[SALES TAX RETN FEE]) AS [Adj DMV/S Tax TOTAL]
FROM dbo_CCR LEFT JOIN dbo_DCR ON (dbo_CCR.[OFFICE CODE] = dbo_DCR.OFFICE) AND (dbo_CCR.[Trans Date] = dbo_DCR.[Work of Date])
GROUP BY dbo_CCR.[Trans Date], dbo_CCR.[OFFICE CODE], dbo_DCR.ID, dbo_CCR.ID
HAVING (((dbo_CCR.[Trans Date]) Between [Start Date] And [End Date]) AND ((dbo_CCR.[OFFICE CODE])="buf") AND ((Sum(dbo_CCR.[EDL Retention]))>0));
Trans Date|OFFICE CODE|SUMOfEDL Retention|Adj DMV/s Tax Total
3/1/2017 | BUF | $27.00 | $3,278.69
3/1/2017 | BUF | $18.00 | $3,278.69
3/1/2017 | BUF | $9.00 | $3,278.69
3/2/2017 | BUF | $27.00 | $2,657.18
3/2/2017 | BUF | $18.00 | $2,657.18
3/2/2017 | BUF | $18.00 | $2,657.18
So I need the Sum of the [SUMOfEDL Retention] column but only the distinct value sum of the [Adj DMV/s Tax Total] in the right column...I'm looking to display this in a access report and the results should be $117.00 & $5,935.87.
I hope this was through and clear...
Thank you for your time
Tom