Query to get Survey response info with count of number of survey given by customer

Query to get Survey response info with count of number of survey given by customer

Version : 14200
DB : PGSQL

OUTPUT :




Query :


SELECT aau.FIRST_NAME AS "Requester",
ti.FIRST_NAME AS "Technician",
Longtodate(srm.responsetime) AS "Responded Time",
srcmt.COMMENTTEXT AS "Comments",
ad.ORG_NAME AS "Account",
sra.VALUE AS "Rating Value",
sra.ANSWER AS "Rating",
(SELECT
count(worm.responseid) "Count" FROM  Survey_Response_Main worm
where worm.userid is not null and worm.userid = wo.REQUESTERID) "Count of User Survey" FROM SurveyResponseRequestMapping srrm
INNER JOIN Survey_Response_Main srm ON srrm.RESPONSEID=srm.RESPONSEID
LEFT JOIN Survey_Response_Answer sra ON srm.RESPONSEID=sra.RESPONSEID
LEFT JOIN Survey_Response_Comment srcmt ON srm.RESPONSEID=srcmt.RESPONSEID
LEFT JOIN WorkOrder wo ON srrm.WORKORDERID=wo.WORKORDERID
LEFT JOIN WorkOrderAccountMapping wam ON wo.WORKORDERID=wam.WORKORDERID
LEFT JOIN AccountDefinition ad ON wam.ACCOUNTID=ad.ORG_ID
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID
LEFT JOIN SDUser td ON wos.OWNERID=td.USERID
LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID
LEFT JOIN SDUser sdu ON wo.REQUESTERID=sdu.USERID
LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID

                  New to ADSelfService Plus?