Querying multiple tables

From: Paul Malherbe <paul(at)tartan(dot)co(dot)za>
To: pgsql-novice(at)postgresql(dot)org
Subject: Querying multiple tables
Date: 2007-08-01 12:33:56
Message-ID: 46B07DB4.4070406@tartan.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi

I have 4 tables:

1) Owner Table - rcaowm - having own_code, owm_name
2) Tenant Table - rcatnm - having tnm_code (owner's code), tnm_acno
(tenant's account number), tnm_name
3) Owner Transactions - rcaowt - having owt_code (owner's code),
owt_date, owt_value
4) Tenant Transactions - rcatnt - having tnt_code (owner's code),
tnt_acno (tenant's account number), tnt_date, tnt_value

I want to produced a query giving the following data:

Owner_Name, Tenant_Name, Sum_Owner_Transaction_Value,
Sum_Tenant_Transaction_Value

Is there any way this can be achieved with a single select statement??

Thanks

Paul

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Glaesemann 2007-08-01 15:32:23 Re: Querying multiple tables
Previous Message Michael Fuhr 2007-07-31 14:32:16 Re: SQL_CALC_FOUND_ROWS equivalent in PostgreSQL