Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NOT EXISTS in Crystal Syntax?

Status
Not open for further replies.

dancar

Technical User
Mar 23, 2001
32
US
All:

I need a report of all clients who have purchased Product A who have NOT purchased Product B.

Writing a selection forumula to find out who has Product A is simple enough, but how do I exclude clients who have both Products A and B?

Dan
 
When a criteria involves looking at an entire group of records, you are doing group selection. You need subtotals to do this. Don't use the simple criteria because that will tell you if a RECORD has product A, not if the CUSTOMER has product A. This will eliminate the records you need to do the second part of the test.

First create two forumlas that say:

If {prod} = "A" then 1 else 0

and another:
If {prod} = "B" then 1 else 0


Now group by customer, and do subtotal of these two columns. Select where the SUBTOTAL of one is > 0 and where the other SUBTOTAL is = 0 Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top