Query to show count of tickets in each module per technician (MSSQL & PGSQL)

Query to show count of tickets in each module per technician (MSSQL & PGSQL)

Tested in Build PGSQL (14300) or MSSQL (14306)


Go to Reports-New Query Report and execute this query.

SELECT 'Request' "Module",aaau.first_name "Technician",count(wo.WORKORDERID) "Request count" FROM WorkOrder wo left join workorderstates wos ON wo.workorderid=wos.workorderid left join aaauser aaau ON wos.ownerid=aaau.user_id where wo.CREATEDTIME >= <from_today> AND wo.CREATEDTIME <= <to_today> group by aaau.first_name 
UNION
SELECT 'Project' "Module" ,aaau.first_name "Technician",count(projectdet.PROJECTID) "Project count" FROM ProjectDetails projectdet left join aaauser aaau ON projectdet.ownerid=aaau.user_id where projectdet.CREATEDTIME >= <from_today> AND projectdet.CREATEDTIME <= <to_today> group by aaau.first_name
UNION
SELECT 'Problem' "Module" ,aaau.first_name "Technician",count(prob.PROBLEMID) "Problem count" FROM Problem prob left join aaauser aaau ON prob.ownerid=aaau.user_id where prob.REPORTEDTIME >= <from_today> AND prob.REPORTEDTIME <= <to_today> group by aaau.first_name
UNION
SELECT 'Change' "Module" ,aaau.first_name "Technician",count(chdt.CHANGEID) "Change count" FROM ChangeDetails chdt left join aaauser aaau ON chdt.technicianid=aaau.user_id where chdt.CREATEDTIME >= <from_today> AND chdt.CREATEDTIME <= <to_today> group by aaau.first_name

                  New to ADSelfService Plus?