Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to retrieve data from either of two tables on select
Message
 
À
10/12/2005 00:52:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01076840
Message ID:
01076844
Vues:
14
>DEar Experts,
>
>I have three tables
>Customer, Ledger, Inventory
>
>In the Cust_Code of Inventory table some times stores customer code or
>Ledger code or some times empty(cash purchase).
>
>My purpose is while taking the report, if the cust_code is not empty i want to
>retrieve customer name from Custome Or ledger name from Ledger based on the
>value stored in the cust_code. how i will do that
>pls help me.
>
>Regards
>Abdulla

You can try something like this;
SELECT NVL(CU.Name,"") AS CustName, NVL(LD.Name,"") AS LedgerName, IIF(EMPTY(IN.Cust_code,"Cash Sale","") AS CashSale, IN.* ;
  FROM Inventory IN ;
LEFT JOIN Customer CU ON IN.Cust_Code = CU.Cust_Code ;
LEFT JOIN Ledger LD ON IN.Cust_Code = LD.Cust_Code ;
INTO CURSOR MyResult
This is off the top of my head and has not been tested so you need to some debugging.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform