How to compute partial sums?

  • Thread starter Thread starter Siegfried Heintze
  • Start date Start date
S

Siegfried Heintze

I have a bunch of restaurant receipts in a database and I want to sum all
the items of each receipt. Each row of the result set would be a receipt
number and a sum of the price of the line items.

What might a query like this look like?

Is is possible to write a query that would list all the line items grouped
by receipt numbers with sub totals for each receipt?

Thanks,
Siegfried
 
Roger Carlson said:
This would be better done in a report.
I assume that means it cannot be done in a single SQL statement but could be
done in some custom code or (better yet) crystal reports? Do you have any
favorite low $ cost alterantives (open source maybe) to purchasing crystal
reports? I suspect I would get quite a few hits if I google searched.

Thanks,
Siegfried
 
I don't believe that Roger suggested Crystal. Access comes with a fabulous
report writer. It is simple to use and very powerful.

You are attempting to create a "report" so use the correct tool and you
won't have any issues.
 
I have a bunch of restaurant receipts in a database and I want to sum all
the items of each receipt. Each row of the result set would be a receipt
number and a sum of the price of the line items.

What might a query like this look like?

If the all query to show all the items of each receipt looks like
this:

SELECT receipt_number, receipt_item_description, receipt_item_price
FROM YourTable;

then the query to sum all the items of each receipt might look like
this:

SELECT receipt_number, SUM(receipt_item_price) AS
receipt_items_price_total
FROM YourTable
GROUP BY receipt_number;

Jamie.

--
 
Personally, I think Access has the best reporting tool around. There has not
been much I have not been able to figure out how to do with assistance from
the various Access newsgroups.

--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
Back
Top