Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date and Time issue in SQL statement 1

Status
Not open for further replies.

royyan

Programmer
Jul 18, 2001
148
US
I had some difficuties to create the SQL statement which calculates the average hits for each hour of the day in a period(such as from 04/01/02 to 04/10/02). The following is my sample statement.
"select count(Hit) as HitCounts from MyTable where Date between '" & fromDate & "' and '" & toDate & "' group by datepart(hh, Date)"

Thanks for help
 
Try:

"select hour(Date) as myHour, count(*) as HitCounts from MyTable where Date between '" & fromDate & "' and '" & toDate & "' group by hour(Date)" Mighty :)
 
This works perfect on my code. Thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top