Quantcast
Channel: Support Portal
Viewing all articles
Browse latest Browse all 20315

SLA violated for certain group

$
0
0
Hi, I have the following query which shoes the sla's violated for all groups but im looking to group on service desk

is this possible. Thanks

Postgres

Version

: 9.2 Build 923


SELECT sdo.NAME "Site",
count(wo.WORKORDERID) "Total",
count(case when wos.ISOVERDUE='1' then 1 else null end) "Sla violated",
count(case when wos.ISOVERDUE='0' then 1 else null end) "Sla not violated",
case when count(wo.workorderid) > 0 then count(case when (wos.ISOVERDUE='1') THEN 1 ELSE NULL END) *100 / count(wo.workorderid) else null end "% Violated",
case when count(wo.workorderid) > 0 then count(case when (wos.ISOVERDUE='0') THEN 1 ELSE NULL END) *100 / count(wo.workorderid) else null end "% not Violated"  FROM WorkOrder wo
LEFT JOIN SiteDefinition siteDef ON wo.SITEID=siteDef.SITEID
LEFT JOIN SDOrganization sdo ON siteDef.SITEID=sdo.ORG_ID
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID
Left join statusdefinition std on wos.statusid=std.statusid where wo.CREATEDTIME >= <from_lastmonth> AND wo.CREATEDTIME <= <to_lastmonth> group by sdo.NAME 
order by 1

Viewing all articles
Browse latest Browse all 20315

Trending Articles