Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql example?
Message
 
 
À
09/08/2000 16:35:46
Gerald McKinsey
Keystone Consulting Services, Inc.
Yorktown, Indiana, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00402536
Message ID:
00403077
Vues:
17
*snip*
>This statement got me 6 records back for my 6 cities I tested with. (no matter how many entries per day, and even if the high-temp was duplicated.)
>
>SELECT City.*, Temperature.ddate, MAX( Temperature.nhightemp);
> FROM keycust!city INNER JOIN keycust!temperature ;
> ON City.icityid = Temperature.icityid;
> GROUP BY City.ccityname;
> ORDER BY City.ccityname

Because the Date is not part of the GROUP BY clause, VFP will return the date located in the last reocrd physically in the table with the same city. With your test records, put the max temp in the first record and not in one of the later records. You should get the wroong date returned.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform