Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Troublesome SQL construction
Message
From
19/12/2006 17:31:58
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Troublesome SQL construction
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01179041
Message ID:
01179041
Views:
58
I'm trying to build a cursor that shows all values from the parent cursor, along with the lookup value of the most recent child record. I'm running into difficulties because not all parent records have child records.

For this set of data, where [Small], [Medium], and [Large] are values from a lookup table.
Customer1 has 3 orders; Oct 1 for 5000 [Small], Nov 1 for 12000 [Large], Dec 1 for 7000 [Medium]
Customer2 has 0 orders;
Customer3 has 2 orders; Nov 1 for 7000 [Medium], Dec 1 for 11000 [Large]
Customer4 has 1 orders; Oct 1 for 4000 [Small]
Customer5 has 0 orders;
The result set should look like:
Customer1  Dec 1   [Medium]
Customer2  {//}    []
Customer3  Dec 1   [Large]
Customer4  Oct 1   [Small]
Customer5  {//}    []
So far, my results have either wound up with 3 Customers(cutting out 2 and 5) or 8 Customers because of the duplicates. I know this shouldn't be that hard, but I'm not seeing what I missed.
Next
Reply
Map
View

Click here to load this message in the networking platform