>I think this is a fairly simple problem, but I haven't really dealt with three tables before within an SQL statement. The results I get are that the first two tables are merged into one record, then the third table is created within a second record. I would like to have fields from all three tables combined into a single record. Here's the code:
>
>
>sele periodamount, yearamount, accruamount, ytdtotals.accountnumber, ;
> ytdtotals.accountname ;
> from glcurrent full join ytdtotals full join glaccruals ;
> on glcurrent.accountnumber = ytdtotals.accountnumber ;
> on glcurrent.accountnumber = glaccruals.accountnumber ;
> into cursor accttot
>
>
>As always, thanks in advance!
Steve,
Placement of join condition is vital. FWIW place each condition with its corresponding join. ie :
select a.order_id, a.cust_id as custId, a.emp_id as empId, ;
b.cust_id, c.emp_id ;
from orders a ;
full join customer b on a.cust_id = b.cust_id ;
full join employee c on a.emp_id = c.emp_id ;
order by 1,4,5
I'm not sure what you want is full join. Experiment with different joins.
Cetin