Multiple filters in a single query??

E

Ernest Stokely

I am obviously doing something wrong. Here is my table content for a
customer order (I am paraphrasing to keep it simple):

# Part A items # Part B items # Part C items

In another small table I have:

Price part A Price part B Price part C

In writing a query to generate the total of an order I need to
calculate the sum:

# Part A items * Price part A + # Part B items* Price part B etc.

In the query two tables are used and I can filter to get the price of
the first part, no problem. When I try to add the second filter the
query fails because it is looking for a nonexistent set of prices.

How do you do this??

Ernie Stokely
 
J

John Vinson

I am obviously doing something wrong. Here is my table content for a
customer order (I am paraphrasing to keep it simple):

# Part A items # Part B items # Part C items

In another small table I have:

Price part A Price part B Price part C

In writing a query to generate the total of an order I need to
calculate the sum:

# Part A items * Price part A + # Part B items* Price part B etc.

In the query two tables are used and I can filter to get the price of
the first part, no problem. When I try to add the second filter the
query fails because it is looking for a nonexistent set of prices.

How do you do this??

I'm afraid you paraphrased a bit too much.

Do you have separate FIELDS for the number of items and the prices?
Could you post the SQL view of the query that does work, and indicate
what else you want to filter?
 
E

Ernest Stokely

John Vinson said:
I'm afraid you paraphrased a bit too much.

Do you have separate FIELDS for the number of items and the prices?
Could you post the SQL view of the query that does work, and indicate
what else you want to filter?

Sorry! Yes, all are separate fields. I don't think the way I am trying
to do this is the right way to implement this common application. You
can't do what I am trying to do. Can you help straighten out my
thinking. I have stared at this so long my mind is in a rut! Thanks

Ernie
 
J

John Vinson

Sorry! Yes, all are separate fields. I don't think the way I am trying
to do this is the right way to implement this common application. You
can't do what I am trying to do. Can you help straighten out my
thinking. I have stared at this so long my mind is in a rut! Thanks

Remember... "fields are expensive, records are cheap". Rather than
having a separate FIELD for each price, have a new RECORD for each
price. You're using a relational database! Use it relationally!

Since I'm not completely clear what you're trying to accomplish, I
can't be sure - but I suspect that you want one record per product,
with that product's price as a field; and another table with fields
for ProductID and quantity (and perhaps a date or other details about
that particular record).
 
E

Ernest Stokely

John Vinson said:
Remember... "fields are expensive, records are cheap". Rather than
having a separate FIELD for each price, have a new RECORD for each
price. You're using a relational database! Use it relationally!

Since I'm not completely clear what you're trying to accomplish, I
can't be sure - but I suspect that you want one record per product,
with that product's price as a field; and another table with fields
for ProductID and quantity (and perhaps a date or other details about
that particular record).


Thanks, John. I am still having trouble thinking "relationally". I now
see how to do the design. Your supposition about my intent is correct.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

VSTO C# add in Outlook.Appointment error 0
subform in main form 2
PowerPivot query 0
Lookup 0
LOOKUP IN MULTIPLE TABLES 3
Order form for bundled products 1
query too slow 1
Form Problem 1

Top