How to display SUM fields from a detailed table in a master table
- by max
What is the best approach to display the summery of DETAILED.Fields in its master table?
E.g. I have a master table called 'BILL' with all the bill related data and a detailed table ('BILL_DETAIL') with the bill detailed related data, like NAME, PRICE, TAX, ... Now I want to list all BILLS, without the details, but with the sum of the PRICE and TAX stored in the detail table.
Here is a simplified schema of that tables:
TABLE BILL
----------
- ID
- NAME
- ADDRESS
- ...
TABLE BILL_DETAIL
-----------------
- ID
- BILLID
- PORDUCT_NAME
- PRICE
- TAX
- ...
The retrieved table row should look like this:
BILL.CUSTOMER_NAME, BILL.CUSTOMER_ADDRESS, sum(BILL_DETAIL.PRICE), sum(BILL.DETAIL.TAX), ...
Any sugguestions?