I get a report weekly (query below) of survey responses for the last week. I need to edit this query to have all surveys from 2019-10-01 to 2020-04-25 in the same format. I cant seem to get it to pull the correct timeframe and i also don't know if i am pulling everything, or if some of these are archived.
- SELECT wo.WORKORDERID AS "Request ID",
- max(wo.TITLE) AS "Request Title",
- max(aau.FIRST_NAME) AS "Requester",
- max(ti.FIRST_NAME) AS "Technician",
- max(srcmt.COMMENTTEXT) AS "Comments",
- longtodate(max(srm.SENDTIME)) AS "Survey Created Time",
- max(srm.result) "%" 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
- INNER JOIN Survey_Question sq ON sra.QUESID=sq.QUESID
- LEFT JOIN Survey_Radio_Option sro ON sra.QUESID=sro.QUESID
- LEFT JOIN Survey_Response_Comment srcmt ON sra.RESPONSEID=srcmt.RESPONSEID
- LEFT JOIN Survey_Main smn ON srm.SURVEYID=smn.SURVEYID
- LEFT JOIN WorkOrder wo ON srrm.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 SDUser td ON wos.OWNERID=td.USERID
- LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID
- WHERE srm.SENDTIME >= <from_lastweek> AND srm.SENDTIME <= <to_lastweek>
- group by wo.WORKORDERID
- ORDER BY wo.WORKORDERID DESC