How to compute partial sums?

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
 
S

Siegfried Heintze

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
 
P

Pat Hartman

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.
 
J

Jamie Collins

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.

--
 
D

Dale Fye

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.
 

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

Top