I am new to Oracle and need to write a script to extract data from three tables.
The code below works and produces results. For every transaction in the transaction_table it produces a row with the customers details.
select
u.account_id,
u.currency_code,
u.country_of_residence_name,
t.bet_desc,
t.event_name,
t.amount,
t.settled_dt,
t.acc_stat_summ_id
from transaction_table t
inner join customer_details u
on t.account_id = u.account_id
where u.country_of_residence_name = 'Canada'
and t.bet_desc = 'Withdrawal'
and t.event_name = 'Bank Transfer'
and t.settled_dt> '01 Aug 2012'
But I need to link it to a further table , how can this be done? I tried he following but got no results.
select
u.account_id,
u.currency_code,
u.country_of_residence_name,
t.bet_desc,
t.event_name,
t.amount,
t.settled_dt,
t.acc_stat_summ_id
from transaction_table t
inner join customer_details u
on t.account_id = u.account_id
inner join bank_transfers b
on t.acc_stat_summ_id = b.bank_transfer_id
where u.country_of_residence_name = 'Canada'
and t.bet_desc = 'Withdrawal'
and t.event_name = 'Bank Transfer'
and t.settled_dt> '01 Aug 2012'