Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL -- getting hourly averages of 15 minute bars
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01593485
Message ID:
01593536
Vues:
37
>
>select account, mHour, MAX(mRating) as MAxRating FROM Ratings GROUP BY account, mHour, mRating
>
>
>gives me losts of results -- presumable the max of the 15 minutes ratings in any given hour.
>But--without writing a whole program--can I use SQL to show each account's
>maximum rating in a given year or a given month.
>Thank you again.

Steve,

SQL can do this and lots of other things.

To show max rating for account for a given year:
select account, max(mRating) as MaxRating, mYear from Ratings  WHERE mYear = ?m.pnYear  GROUP by account, mYear
pnYear will be a year parameter

If you want maximum rating for a given month, I assume it's for a given month of a given year, not just across all months in the table?

If the former, then
select account, max(mRating) as MaxRating, mYear, mMonth from Ratings  WHERE mYear = ?m.pnYear  AND mMonth = ?m.pnMonth GROUP by account, mYear, mMonth
where pnYear and pnMonth your parameters.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform