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

Re : Need Help to Create Survey Report Which has User Comments

$
0
0
Hi Junu,

You could use the query below to generate the report.

SELECT  wo.workorderid "Request ID", MAX(CAST(wo.TITLE AS VARCHAR(30))) "Request Title",
MAX(aau.FIRST_NAME) "Requester",longtodate(MAX(wo.CREATEDTIME)) "Created Time",
MAX(ti.FIRST_NAME) "Technician", MAX(catdef.categoryname) 'Category',
longtodate(MAX(wo.COMPLETEDTIME)) "Completed Time",
sum(sadt.RATING)/(count(sadt.RATING)*(select count(SURANSID) from surveyanswers))*100 "% Rating",
 MAX(CAST(spre.COMMENTS AS VARCHAR(50))) "Comments" FROM SurveyPerRequest spr
INNER JOIN SurveyPerRequestExt spre ON spr.SURVEYID=spre.SURVEYID
LEFT JOIN SurveyDetails sdt ON spre.SURVEYID=sdt.SURVEYID
LEFT JOIN SurveyAnswers sadt ON sdt.SURANSID=sadt.SURANSID
LEFT JOIN WorkOrder wo ON spr.WORKORDERID=wo.WORKORDERID
LEFT JOIN SDUser sdu ON wo.REQUESTERID=sdu.USERID
LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID
Left join categorydefinition catdef on wos.categoryid=catdef.categoryid
LEFT JOIN SDUser td ON wos.OWNERID=td.USERID
LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID WHERE spre.CREATEDTIME>= <from_lastmonth> AND spre.CREATEDTIME<= <to_lastmonth> group by wo.workorderid

Regards,
Stephen

Viewing all articles
Browse latest Browse all 20315

Trending Articles