So I need some help creating report(s). I am using IReport to build and run the report but I need help with the script and how to accurately get rid of the 'off times'
Code:
SELECT swtickets.ticketmaskid ticketmaskid, swstaff.fullname fullname,swticketstatus.title status_title,swdepartments.title dept_title, swauditlogs.actionmsg actionmsg,
FROM_UNIXTIME((swtickets.dateline), '%m/%d/%Y') AS open_date,
DAYOFWEEK(FROM_UNIXTIME(swtickets.dateline)) AS open_day_of_week,
FROM_UNIXTIME((swtickets.lastactivity), '%m/%d/%Y') AS closed_date,
DAYOFWEEK(FROM_UNIXTIME(swtickets.lastactivity)) AS closed_day_of_week,
SEC_TO_TIME(CASE WHEN swtickets.totalreplies = 0 THEN 0 ELSE (max(swticketposts.dateline)- min(swticketposts.dateline)) DIV swtickets.totalreplies END) avg_response,
SEC_TO_TIME(CASE WHEN swtickets.totalreplies = 0 THEN 0 ELSE (max(swticketposts.dateline)- min(swticketposts.dateline)) END) time_to_resolution,
DATEDIFF(FROM_UNIXTIME(swtickets.lastactivity),FROM_UNIXTIME(swtickets.dateline)) AS days_to_resolution_diff
FROM swticketposts
INNER JOIN swtickets on swticketposts.ticketid = swtickets.ticketid
INNER JOIN swstaff on swtickets.ownerstaffid = swstaff.staffid
INNER JOIN swticketstatus on swtickets.ticketstatusid = swticketstatus.ticketstatusid
INNER JOIN swdepartments on swtickets.departmentid = swdepartments.departmentid
INNER JOIN swauditlogs on swtickets.ticketid = swauditlogs.ticketid
GROUP BY swticketposts.ticketid
ORDER BY swstaff.fullname, swticketstatus.title
For the resolution times I can calculate the number of days and subtract ~16 hours per weekday and 24 hours per weekend but how to I deal with response time?
Thank you,
Mark
PS I am fairly new to SQL scripts so be gentle on me