• TecNQ (5/8/2013)


    Thanks again.

    The last code needed a GROUP BY to work, but it works!

    The first one didn't. It came back saying "Incorrect syntax near DISTINCT".

    I assume that's the COUNT(DISTINCT...)?

    Cheers

    Yeah, sorry, you got here before I could finish my edit on the GROUP BY, realized I'd missed it when I copy/pasted. 😀

    Count OVER should allow for DISTINCT, but you're right, it's most likely in there. I rarely use the windows aggregations functions unless I'm doing something incredibly odd, like including multiple aggregations in different patterns off the same dataset and don't want to repull the data.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA