Click to See Complete Forum and Search --> : display sum of products in order (Access)


matthewb3660
09-04-2008, 06:40 AM
Hi

I am working on an access database and I need to construct a query to get the total of an order. There is a products table with products and prices and an orders table for orders placed by customers with several fields for each product ordered and the quantity.

Can anyone offer assistance as to how I might do this?

Hack
09-04-2008, 07:29 AM
Welcome to DevX :WAVE:

Without knowing the specific table layout, I can only be general.

Basically you would want to use the aggregate SQL SUM function. Something likeSELECT SUM(orders) FROM tablename WHERE blah = blah As OrderTotal

AngelSoft
09-04-2008, 07:43 AM
as mentioned by hack i cannot tell u the exact answer what u want
try this out

select sum(quantity) from ordertable group by product

Hack
09-04-2008, 01:52 PM
Here is a list of aggregate sql functions (http://databases.about.com/od/sql/l/aaaggregate1.htm) that will doubtless come in handy from time to time.