• JayWinter (7/31/2012)


    I did remove the GROUP BY and and achieved the correct result. My original post shows a 2nd script without GROUP BY.

    Your DISTINCT clause is hiding the problem. DISTINCT is processed after the GROUP BY, so any duplicates will be included in your totals for the GROUP BY, but will be excluded in your QA query.

    DISTINCT is also superfluous in conjunction with a GROUP BY anyhow. The results of a simple GROUP BY statement are necessarily distinct. (That may not be the case if you have multiple grouping sets.)

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA