Having considered and attempted to implement the suggestions above, I think I can clarify a bit. For purposes of satisfying the user (exec management), the report must be grouped by date (monthly since the beginning of this year). Therefore, the entries for customers who order twice are often on different pages (and in different monthly groups) so the "previous" solution you proposed doesn't seem to fit.
More information:
88,000+ records, 2000+ customers, data since 2003
I wrote an "Add Command" (DISTINCTNAMEQUERY) in the "Database Expert" and browsed the resulting data in the virtual table shown in the CR Field Explorer. As I had hoped, the results were 128 unique customer names. So I ran the report using the selection expert pointed to DISTINCTNAMEQUERY. UGH, the server ran full tilt for several minutes before I stopped it and saw that it was retreiving many more instances than 128.
Here's what is displayed at Database>Show SQl Query
SELECT "data21"."DATE", "data61"."TITLE", "data40"."FIRST_DATE", "data21"."NAME"
FROM ("data40" "data40" INNER JOIN "data21" "data21" ON "data40"."CLIENT"="data21"."CLIENT") INNER JOIN "data61" "data61" ON "data40"."REF_CODE"="data61"."CODE"
WHERE "data21"."DATE">{d '2009-01-01'}
SELECT DISTINCT NAME, CODE, DATE FROM DATA21 WHERE DATE>'01/01/2009' and (CODE='CAT' OR CODE='DOG' OR CODE='FISH')
The last two lines are the code from my DISTINCTNAMEQUERY "Add Command". When I run the last two lines directly on the SQl server, I instantly get 128 unique results, just like when I "browse data" in the CR Field Explorer.
The Selection Expert formula is:
{DISTINCTNAMEQUERY.DATE} > Date (2009, 01, 01) and
{DISTINCTNAMEQUERY.CODE} in ["CAT", "DOG", "FISH"]
Despite the DISTINCTNAMEQUERY command yielding only 128 unique names, when I run the report it wants to print 100s if not 1000s of entries many of which are duplicates.
I don't know where my logic is flawed but, obviously, I'm not understanding something here. Can you see where my error is?
Thanks.
Bill Murphy
EDIT: I just realized my original question concerned only products A and B yet my code shows 3 products. One can be ignored. It is an exclusive code so it is easy to pull out the "Fish" customers from the database. It is the "Cat" and "Dog" customers that overlap and cause multiple entries from the same customer. It is not important for the report to list what they ordered so I just want a customer list without the overlap.
Edited by bmurphywa - 08 Aug 2009 at 5:25pm