SELECT B.SALES_NAME, Sum(CUSTOM.IFY_ARREARAGE_AMOUNT) AS Total
FROM CUSTOM INNER JOIN [SELECT DISTINCT DAILY_SALES_MANAGENT_MAIN.CUSTOM_NAME, DAILY_SALES_MANAGENT_MAIN.SALES_NAME
FROM DAILY_SALES_MANAGENT_MAIN
]. AS B ON CUSTOM.CUSTOM_NAME = B.CUSTOM_NAME
GROUP BY B.SALES_NAME;
SELECT B.SALES_NAME, Sum(CUSTOM.IFY_ARREARAGE_AMOUNT) AS TotalFROM CUSTOM INNER JOIN (SELECT DISTINCT DAILY_SALES_MANAGENT_MAIN.CUSTOM_NAME, DAILY_SALES_MANAGENT_MAIN.SALES_NAMEFROM DAILY_SALES_MANAGENT_MAINWHERE (((DAILY_SALES_MANAGENT_MAIN.DATE) Between #2/1/2009# And #2/10/2009#)))AS B ON CUSTOM.CUSTOM_NAME = B.CUSTOM_NAMEGROUP BY B.SALES_NAME