>>Use Orders.OrderDate IS NULL to make it SQL Server compatible :)
>>
>>>
SELECT Customer.CustomerID, Customer.CustName, Orders.OrderID, ;
>>> Orders.OrderDate, Orders.Destination ;
>>> FROM Customer ;
>>> LEFT OUTER JOIN orders ON Orders.CustomerID = Customer.CustomerID ;
>>> WHERE ISNULL(OrderDate) OR OrderDate = ( SELECT MAX(OrderDate) FROM Orders Recent WHERE Recent.CustomerID = Orders.CustomerID)
>>>
>>>
>>>
>VFP changed it to IS NULL anyways. Unfortunately, I'd previously tried OR IS NULL, and VFP 8.1 comes back with "SQL expression is too complex" Error 1845. Using Sys(3055, 2040) still returns the error.
If you're using VFP8 move WHERE TO JOIN condition as Sergey suggested. Otherwise I would recommend the other query or add customers without orders with UNION. In my tests (see the whole thread) using derived table technique was faster than the way Sergey showed.
If it's not broken, fix it until it is.
My Blog