Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL - for datetime field.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00098538
Message ID:
00098616
Views:
32
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform