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:
01593504
Vues:
43
>I am trying this. My field name was in fact mHour
>
>
>select mhour, avg(mRating) as AvgRating from Ratings GROUP BY mhour
>
>
>It's working. However the table has 700,000 + records in it, and the above gives me a table with 24 records,
>with each hour having an average for that hour in the entire table. In point of fact, my Ratings table is really like this:
>
>
>mYear     mMonth     mDate     mHour     mMin     mRating
>2013	5	         5/9/2013	    16	1600	13.84
>2013	5	         5/9/2013	    17	1615	13.44
>
>
>And what I really need is a row-by-row description, for every single day, of the average hourly ratings?
>Thank you so much,
>Steve

In this case you need to add mYear, mMonth, mDate columns to the list of GROUP by columns, e.g.
select mYear, mMonth, mDate, mHour, AVG(mRating) AS AvgRating FROM Ratings GROUP BY mYear, mMonth, mDate, mHour
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