Tested in MSSQL build (14306)
SELECT res.resourcename 'Asset Name', res.assettag 'Asset Tag',res.serialno 'Asset Serial No.', rs2.statedesc 'Previous State',rs1.statedesc 'Current State',DATEADD(s,DATEDIFF(s,GETUTCDATE() ,getdate()) + (rsh.STARTTIME/1000),'1970-01-01 00:00:00') 'State Change From date', DATEADD(s,DATEDIFF(s,GETUTCDATE() ,GETDATE()) + (rsh.ENDTIME/1000),'1970-01-01 00:00:00') 'State Change To Date',AUS.FIRST_NAME 'State Change Done by' FROM Resources res LEFT JOIN resourcestatehistory rsh ON rsh.resourceid=res.resourceid LEFT JOIN ResourceState rs1 ON rs1.resourcestateid=rsh.resourcestateid LEFT JOIN ResourceState rs2 ON rs2.resourcestateid=rsh.prevresourcestateid LEFT JOIN AaaUser aus ON aus.user_id=rsh.userid LEFT JOIN SystemInfo sysinfo ON sysinfo.workstationid=res.resourceid ORDER BY 1