• Your first query was getting the count of distinct Incident_id, while your second query was getting distinct combinations of Incident_id and policy_name. Surely you can see those two are not the same. They will only return the same count if every Incident_id only has one policy_name associated with it.

    Now, which of the 2 cases are you looking for? I thought it was obvious you were looking for the second choice, but I'm not going to assume.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]