DenisCooper
Registered User.
- Local time
- Today, 14:58
- Joined
- Feb 23, 2013
- Messages
- 31
Hi,
I have two tables, one showing expenses and one showing payments received. They are then linked to another table with all property details.
I am try to write a query which shows the payments received and expenses paid on each property. I can do this as seperate queries, but then when i create the third query to show everything together it generates around 15000 records.
my queries are shown below
Query to show payments received by tenant per property.
SELECT tblProperty.DisplayName, tblTenant.DisplayName, tblPayments.DateReceived, tblPayments.AmountReceived
FROM (tblTenant INNER JOIN (tblProperty INNER JOIN tblLease ON tblProperty.PropertyID = tblLease.cboProperty) ON tblTenant.TenantID = tblLease.cboTenant) INNER JOIN tblPayments ON (tblTenant.TenantID = tblPayments.cboTenant) AND (tblTenant.TenantID = tblPayments.cboTenant);
Query to show expenses made per property.
SELECT tblProperty.DisplayName, tblExpenses.DatePaid, tblExpenses.AmountPaid, tblExpenses.ExpenseType
FROM tblProperty INNER JOIN tblExpenses ON tblProperty.PropertyID = tblExpenses.ExpenseLinkedToProperty;
End goal - to create a report with details from both to show all expenses and all payments received by property.
Any help greatly appreciated.
Thanks
Denis
I have two tables, one showing expenses and one showing payments received. They are then linked to another table with all property details.
I am try to write a query which shows the payments received and expenses paid on each property. I can do this as seperate queries, but then when i create the third query to show everything together it generates around 15000 records.
my queries are shown below
Query to show payments received by tenant per property.
SELECT tblProperty.DisplayName, tblTenant.DisplayName, tblPayments.DateReceived, tblPayments.AmountReceived
FROM (tblTenant INNER JOIN (tblProperty INNER JOIN tblLease ON tblProperty.PropertyID = tblLease.cboProperty) ON tblTenant.TenantID = tblLease.cboTenant) INNER JOIN tblPayments ON (tblTenant.TenantID = tblPayments.cboTenant) AND (tblTenant.TenantID = tblPayments.cboTenant);
Query to show expenses made per property.
SELECT tblProperty.DisplayName, tblExpenses.DatePaid, tblExpenses.AmountPaid, tblExpenses.ExpenseType
FROM tblProperty INNER JOIN tblExpenses ON tblProperty.PropertyID = tblExpenses.ExpenseLinkedToProperty;
End goal - to create a report with details from both to show all expenses and all payments received by property.
Any help greatly appreciated.
Thanks
Denis