Friday, February 24, 2012

Keep records that contain certain attributes

Have a report that I want to keep certain attributes and as long as the report contains this certain attribute, bring all other attributes with it. Better with an example. In this report I am specifically looking for attribute "Alcohol", if I find this attribute I want to include all others that fit with this record's Primary Key which could include, "Drugs","Arson","Vandalism", etc. Problem is when I try to use a paramater or filter I get the "Alcohol" Attribute but not the "Drugs","Arson","Vandalism", etc. Conversely since I dont have any filter/paramater set I get everything even if it does not include "Alcohol"

suggestions?

thansk in advance

km

Hi km

I am having a bit of trouble understanding what data you are working with.
Once this is clear perhaps I can help.
Does your data-set look like the following?

Primary Key | Problem
-
1 Drugs
1 Alcohol
1 Vandalism
2 Theft
2 Drugs

And you want to display all rows with PrimaryKey = 1 (since it includes alcohol), but not any rows with Primary Key 2?

If that is the case it will definitely be easiest to do this in you query itself, not in the report.
Something like:

Select * From Table WHERE PrimaryKey IN
(SELECT PrimaryKey From Table WHERE Problem = 'Alcohol'

Cheers
Mark
|||

thanks Mark

Yes this is similiar to my data found out that there is a unique key for each atttribute so all is resolved

thanks for your response

km

No comments:

Post a Comment