Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a view to look at one field or another
Message
 
À
16/03/2005 09:17:46
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
00996169
Message ID:
00996312
Vues:
12
>Invoice Table - Fields - CustomerNumber, City, State, County, Shiptokey
>Shipto Table - Fields - ShiptoKey, City, State, County
>
>I need to be able to build an SQL statement that will give me the actual shipping address used on an invoice. If the order was shipped to the billto, there will not be a ShiptoKey in the Invoice Table for that record. If the order was shipped to a different shipping address, the ShiptoKey field will be populated and there will be a matching record in the Shipto Table file.
>
>I can make a join to pull BOTH addresses, but I want to make one that pulls only the actual shipping address regardless of wether a Shipto record was involved.
>
>Does that make sense?
>
>>Because of my Enghlish it is hard to me to understand what you want. But can you post some exmaples to see what can I do?


What about:
SELECT CustomerNumber, IIF(EMPTY(ShipToKey), City, ShipTo.City) AS City,;
                       IIF(EMPTY(ShipToKey), State, ShipTo.State) AS State,;
                       IIF(EMPTY(ShipToKey), County, ShipTo.County) AS County
       FROM Invoice;
       LEFT JOIN ShipTo ON Invoice.ShipToKey == ShipTo.ShipToKey;
       INTO CURSOR cInvoice
Is this works for You?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform