Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to retrieve data from either of two tables on select
Message
 
To
10/12/2005 00:52:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01076840
Message ID:
01076844
Views:
15
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform