Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MAX function in a select statement
Message
 
À
19/04/2001 13:02:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00497396
Message ID:
00497431
Vues:
13
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform