Count(Distinct) Error

I am trying to build a query that will provide summary information with counts of different varchar2 data fields. While I get output, I find that the counts are incorrect. Oddly, when I add the actual data field into the query to see where duplication may be occurring, instead I get the correct counts for that data field. Once removed, I get the duplication again.

I have done a lot of data aggregation like this and have never before seen a situation where I get duplication within the counts when the parent data field is providing the correct data. It is terribly counter-intuitive to me and I just don't know where to go with this....

I am using TDP Thanks.

I want to say that this seems to be more of a SQL issue than a TDP issue, but hard to say without understanding what query you're using and how you're using TDP to execute it.

Maybe some SQL experts can look at your query to give some suggestions?

Possibly, and I don't want to discount that. However, before I go into the struggle of breaking apart the query to isolate the various possibilities, I thought I'd throw this out there based on my past experience: Issues in TDP that don't have a logical path to resolution are nearly always due to a bug.

I have the field set on Count(distinct) via the Query Builder. When I include the field and a count of the field, I get the correct results. When I include the count of the field by itself, I get count duplication in the results. If there are only five unique values in the field, how can I possibly get a count of seven when aggregating with Count(distinct)?