Balance report

cyber27uk

New member
Local time
Today, 11:33
Joined
Dec 18, 2011
Messages
4
I have two tables:

Revenue table

Revenue ID
Revenue_Date
Revenue_Description
Revenue_Value

Expenditure table

Expenditure ID
Expenditure_Date
Expenditure_Description
Expenditure_Value

How do i create a report that will display total Revenue_Value - total Expenditure_Value = balance

Sorry for being a newb

Thanks
 
Use a Union query?

Really should have just one table and a field to indicate a deposit or payment.
 
SQL:
SELECT
   R.TotalRevenue,
   E.TotalExpenditure,
   R.TotalRevenue - E.TotalExpenditure AS Balance
FROM
   (
      SELECT
         SUM(Revenue_Value) AS TotalRevenue
      FROM
         RevenueTable
   ) AS R,
   (
      SELECT
         SUM(Expenditure_Value) AS TotalExpenditure
      FROM
         ExpenditureTable
   ) AS E
 
How are these tables related? I don't see a foreign key in the Expenditure table. As others have said, you need only one Transactions table, If you are tracking different accounts, then you need an Account table as well, which is then related to the Transactions table. And we have discussed these issues with you before in previous posts.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom