Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting most recent orders?
Message
 
 
To
11/09/2008 14:10:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01249462
Message ID:
01346778
Views:
7
Change
WHERE OrderDate = ( SELECT MAX(OrderDate) FROM Orders Recent WHERE Recent.CustomerID = Orders.CustomerID) 
-- to
  AND OrderDate = ( SELECT MAX(OrderDate) FROM Orders Recent WHERE Recent.CustomerID = Orders.CustomerID) 
>>
>>SELECT Customer.CustomerID, Customer.CustName, Orders.OrderID, ;
>>			Orders.OrderDate, Orders.Destination ;
>>	FROM Customer ;
>>		LEFT OUTER JOIN orders ON Orders.CustomerID = Customer.CustomerID ;
>>	WHERE OrderDate = ( SELECT MAX(OrderDate) FROM Orders Recent WHERE Recent.CustomerID = Orders.CustomerID) 
>>
>
>Now I've got a new twist on this - I need to include ALL customers, even those without an order. The above SQL filters those out. I've been beating my head against it without success. Any ideas?
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform