showing columns and a column's sum

  • Thread starter Thread starter aa
  • Start date Start date
A

aa

if I have a table containting InvoiceNumber, ItemCode, ItemPrice
and I whish to view all items belonging to a prticular invoce, I run
Select ItemCode, ItemPrice
FROM ...
WHERE InvoiceNumber="something"

How do I modify this query to shows also the total of this invoice, i.e. the sum of ItemPrice ?
 
This is almost always done in a report with group or report totals. However,
you could try:
Select ItemCode, ItemPrice
FROM ...
WHERE InvoiceNumber="something"
UNION
Select "All Items", Sum(ItemPrice)
FROM ...
WHERE InvoiceNumber="something"

--
Duane Hookom
MS Access MVP


if I have a table containting InvoiceNumber, ItemCode, ItemPrice
and I whish to view all items belonging to a prticular invoce, I run
Select ItemCode, ItemPrice
FROM ...
WHERE InvoiceNumber="something"

How do I modify this query to shows also the total of this invoice, i.e. the
sum of ItemPrice ?
 
Back
Top