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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QUERYING SAME FIELD, DIFFERENT VALUES 1

Status
Not open for further replies.

ssiroky

Technical User
Sep 4, 2003
17
US
I'm doing a search for records that have two values. For example. I want to grab all accidents (offense_code = "7000") and of those, I want all that also have an offense_code of "2450". I don't want only "7000", nor do I only want 2450's. Any ideas. THanks.
 
I see.

This si a bit tricky as what you want are those that have BOTH 7000 and 2450 as values.

Here's one way:

Group by the accident.

Report->Edit Selection Formula->Record:
{table.offense_code} in ["7000","2450"]

Now create a formula to count the number of distinct offense codes per Accident:

distinctcount({table.offense_code},{table.accident})

Now in the Report->Edit Selection formula->Group place:

distinctcount({table.offense_code},{table.accident}) > 1

That should work.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top