Jump to content

Help writing an Oracle script to join three tabels


chiba

Recommended Posts

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'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.