Query to get account based request status COUNT
Version : 11027
DB : PGSQL
OUTPUT :
Select ad.org_name "Account",
Count(wo.workorderid) "Total",
count(case when std.statusname='open' THEN 1 ELSE NULL END) "open status Requests",
count(case when std.statusname='In Progress' THEN 1 ELSE NULL END) "In Progress status Requests",
count(case when std.statusname='Closed' THEN 1 ELSE NULL END) "Closed Requests" from workorder wo
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID
left join workorderaccountmapping woacc on wo.workorderid = woacc.workorderid
Left join accountdefinition ad on woacc.accountid = ad.org_id
LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID WHERE (wo.ISPARENT='1') and wo.CREATEDTIME >= <from_thismonth> AND wo.CREATEDTIME <= <to_thismonth> group by ad.org_name
New to ADSelfService Plus?