Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Query to join tables
Message
De
20/07/2000 13:34:06
 
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Divers
Thread ID:
00394741
Message ID:
00395009
Vues:
14
>>I need to join 2 tables to link the key and reference to the
>>other fields.
>>
>>Eg: Table : Customer (customer table with detial particular)
>> Table : DayTrans (keeps daily transactions)
>>
>>The DayTrans table has a CustCode and I need to link it to
>>Customer table by "CustCode" and retrieve the Customer.Address
>>field. How could I do it by the SELECT statment?
>>Is it using the JOIN INNER or OUTER? Pls advise, thanks.
>
>What is your database engine? Access? Use the Access Query designer.
>
>If it is another engine, you could create a dataenvironment, add a command and the you have the Query Builder button that will help you build query like the one you want.
>
>Your query will look like this:
>SELECT *
>FROM Customer INNER JOIN DayTrans
>ON Customer.CustCode = DayTrans.CustCode

I need to list all fields in DayTrans and link to Customer only to get
the Address. Am I right to code as:

SELECT DayTrans.CustCode, DayTrans.CustName, Customer.Address
FROM DayTrans INNER JOIN Customer
ON DayTrans.CustCode = Customer.CustCode
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform