Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql example?
Message
De
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:
00403068
Vues:
15
>>>1.- Select city,date,Max(temp) from yourtable order by city group by city,date
>>>
>>

>>This select would return date from last physical record for each city not date corresponded to Max(temp).
>
>No. This SQL statement would return the maximum temp recorded for each city for each day. If you only had 1 recorded temp per day, it would return all records in the table.

Actually that worked pretty well. I thank everyone for their input, I now know what to read up on again (group by & max) I think my brief description was interpreted in different ways by different people. Just to recap, I did want only the all time high for each city.

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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform