Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAX function in a select statement
Message
 
To
19/04/2001 13:02:49
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00497396
Message ID:
00497431
Views:
14
Sorry, the fields from the Customer table may be confusing in my original answer to you. I only SELECTed Customer.CustNo. I meant to also have Customer.Name in the list:
SELECT ;
  Customer.CustNo,;
  Customer.Name,;
  Invoice.InvNo,;
  Invoice.InvDate,;
  Invoice.InvAmt ;
FROM ;
  Customer ;
  JOIN Invoice on Customer.CustNo=Invoice.CustNo ;
WHERE ;
  DTOS(Invoice.InvDate)+STR(Invoice.InvNo,6) = ;
    (SELECT MAX(DTOS(InvTemp.InvDate)+STR(InvTemp.InvNo,6)) ;
      FROM Invoice InvTemp WHERE InvTemp.CustNo=Invoice.CustNo) ;
INTO ;
  CURSOR result
If you don't need any data from the Customer table, you can remove that from the field list and the JOIN of course.

--Brad
Previous
Reply
Map
View

Click here to load this message in the networking platform