Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a view to look at one field or another
Message
From
20/03/2005 13:21:36
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00996169
Message ID:
00997687
Views:
12
This works perfectly! Thank you.

>>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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform