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

Reporting question

Status
Not open for further replies.

MattCR

Technical User
Aug 7, 2007
2
US
Hi all,

For starters, I apologize if I'm posting on a redundant topic; my background is in data analysis rather than DBMS or programming, so I may be beating a dead horse. I've been asked to design a relatively simple data structure for someone, and seem to have gotten myself stuck. My question is really about filters and querying for the purpose of generating reports, so hopefully I can explain this coherently.

In my database, let's assume I have data on both (a) different foods offered by a producer, and (b) consumers. Aside from numerous fields that exist uniquely for both foods and consumers, they both have approx. 20 fields/variables in common with each other, or at least that mean comparable things.

For consumers, these are preferences (e.g., "sour," "bitter," "crunchy," "soft," and so forth), whereas for foods offered, they are qualities exhibitied(e.g., "sour," "bitter," and the like). These are stored as the "Yes/No" datatype with checkboxes. So, if a consumer displayed preference for sour, salty, crunchy, spicy, then there will be "checks" for these fields in the data, while the other fields remain blank. The same for different foods.

I need to provide a report of all of the different food types, where for each food type, the is a listing of which consumers showed preference, based on common preferences expressed (by consumer) or qualities exhibited (by product). So if a certain food exhibits...sour, bitter, crunchy, I would thus need to provide a list of those consumers exhibiting preference for all of these qualities. If they show preference for these qualities PLUS other qualities which the food does not exhibit, that is okay. In and of itself, it does not seem to be that complex...there are just a lot of fields which need to matched. What is the best way to do this? Can it be done simply by designing a parameter query or filter of some sort?



Thanks for any help,

- Matt

 
How are your tables structured?

[tt]tblConsumer
ConsumerID

tblConsumerPrefs
ConsumerID
QualityID

tblFoods
FoodID

tblFoodQuality
FoodID
QualityID

tblQualities
QualityID
Description[/tt]

Something like the above should make it easy to select consumers who like a quality of a food.
 
Hi Remou,

Thanks for responding. The tables are stuctured in a normal Case x Field manner, with separate tables comparable to what you've shown above. I'm worried that my tables, though, might be structured a bit differently from your's in one respect. You showed that each quality has its own ID (QualityID). This means that Qualities/Preferences are arranged as records/cases somehow for you, correct? I only have them stored as fields, not as records or cases, as shown below. Does this make sense and, if so, is it going to cause problems? Thanks again!



ID Food Crunch Sour Sweet Salty
1 Pretzel X X
2 Candy Bar X X
3 SourLemon X X



ID Consumer Crunch Sour Sweet Salty
1 BJT X X X X
2 TJD X
3 TGH X X X
 
It may not cause problems, per se, but normalized tables such as Remou's will be easier to extract data from. You should be able to normalize your data with a UNION query. A slightly modified version of a query found here could help: thread703-1394788


-V
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top