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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Half hour incremental report Stored procedure

Status
Not open for further replies.

HebieBug

Programmer
Jan 8, 2001
354
JP
Would anyone have some code to pull a datetime field into half an hour alotments.
Am after a count for how many phone calls we recieve every half and hour.
 
Is this what you need?

SELECT
count(datefld) TotalCol,
datepart(hh, datefld) HourCol,
datepart(n, datefld) /30 MinCol
FROM
tablename
GROUP BY
datepart(hh, datefld),
datepart(n, datefld) /30

ORDER BY
datepart(hh, datefld),
datepart(n, datefld) /30
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top