question

mastanvali avatar image
mastanvali asked

How To Increse Hours and Get Daily Report

SELECT CONVERT(DATE, fld_event_created_on, 112) , CAST(DATEPART(hh, fld_event_created_on) AS CHAR(3)) + '-' + CAST(( DATEPART(hh, fld_event_created_on) + 1 ) AS CHAR(3)) AS hour , SUM(CASE WHEN fld_event_subject = 'Cold Call' THEN 1 ELSE 0 END) AS ColdCall , SUM(CASE WHEN fld_event_subject = 'Referal Call' THEN 1 ELSE 0 END) AS ReferalCall , SUM(CASE WHEN fld_event_subject = 'Email Sent' THEN 1 ELSE 0 END) AS [Email Sent & Fax Sent] FROM tbl_event WHERE ( fld_event_created_on >= '12/15/2015 12:00:00 AM' AND fld_event_created_on <= '12/15/2015 12:00:00 PM' ) GROUP BY DATEPART(hh, fld_event_created_on) , CONVERT(DATE, fld_event_created_on, 112) ORDER BY 1 -- I Need Hour Column Like 17:30-18:30,18:30-19:30....04-30-05:30 -- Plz Check Attached Screen Shot it is Executing Like that 11-12,12-13.i Need Above Manner -- Based On This Time Period[17:30-18:30] in this Column i want Get Count for fld_event_subject. I Need Like This ![alt text][1] -- [1]: /storage/temp/3113-report.png
sql-server-2008sql-server-2005sqlsqlserver
report.png (15.5 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.