Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help in one select with 3 tables
Message
De
23/04/2003 06:10:10
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/04/2003 05:55:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00780507
Message ID:
00780511
Vues:
11
This message has been marked as the solution to the initial question of the thread.
>Hi
>
>I have 3 tables
>
>
>Table1 has fields : NumDoc , Ref , TotLinha
>
>Table2 has fields : NumDoc , NomeCli , NumCli
>
>Table3 has fields : Ref , Stock
>
>
>I want make a select , to have a new table with all fields of 3 tables .
>
>See table1 is main table . NumDoc has in Table1 and Table2 . Ref is in Table1 and Table3 .
>
>
>Imagine table1 has :
>
>1 , Art1 , 100
>2 , Art2 , 200
>3 , Art3 , 300
>
>
>Imagine table2 has :
>
>1 , Peter , 1000
>2 , John , 2000
>3 , Sergey , 3000
>
>Imagine table3 has :
>
>Art1 , 11111
>Art2 , 12500
>Art3 , 11987
>Art4 , 14555
>Art5 , 19000
>
>I want new table has :
>
>1 , Art1 , 100 , Peter , 1000 , 11111
>2 , Art2 , 200 , John , 2000 , 12500
>3 , Art3 , 300 , Sergey , 3000 , 11987
>
>Do you understand ?
>Can you help me ?
>
>Thanks
Select a.Numdoc, a.Ref, a.TotLinha, ;
  b.NomeCli, b.NumCli, ;
  c.Stock ;
  from table1 a ;
  inner join table2 b on a.NumDoc = b.Numdoc ;
  inner join table3 c on a.Ref = c.Ref
PS:You might need to use 'left join' depending on your needs.
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