>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