Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL - for datetime field.
Message
 
À
11/05/1998 18:01:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00098538
Message ID:
00098616
Vues:
33
I would change the suggestion from:
>> SELECT datetime, ttoc(datetime),count(*) from tablename group by 2 into cursor busytime
to
>> SELECT datetime, hour(datetime),count(*) from tablename group by 2 into cursor busytime

the first will give you a count for each distinct time, down to the second (or even fraction, not sure), so unless two events happened on exactly the same time, you would get a count of 1 for each time that anything happened. by taking the hour that events occurred, you get a count of how many events occurred during that hour. with a tad more effort, you can adjust the resolution.

...int( (hour(datetime)*60+minute(datetime) )/15 )
will give a count of events during a 15 minute period. don't expect any 0's to be returned. if there is no data during that time, there will be no summary of data of that time.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform