Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql problem joining three tables
Message
De
01/03/2002 12:32:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00627038
Message ID:
00627059
Vues:
12
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform