• Dwain,

    I noticed the problem when I did a

    select distinct icn count.

    my total came to 264500

    when I ran this query, I got 264461 total results. I went back and looked at the ones that are not in the list, the data looks exactly like the other claims. no difference and no null values in the fields.

    So if I created a calendar using that tally, how do I query that calendar in the same way to see if I get better results?

    my goal is to count the number of distinct days per ICN.

    Here is how my data is set up.

    ICNFrom Date of ServiceTo Date of ServiceDetail Status Code

    1234520120810 12:00:0020120811 12:00:00P

    1234520120801 12:00:0020120805 12:00:00P

    1234520120810 12:00:0020120810 12:00:00P

    1234520120813 12:00:0020120815 12:00:00P

    The total distinct days on this ICN is 10 if you count correctly.

    How can I use your tally table to count distinct Dates of Service in both from date of service and to date of service ?