使用资产报表导出离线超过一定时间(一周或者一个月)的电脑设备(*string字段强制转化bigint*)

使用资产报表导出离线超过一定时间(一周或者一个月)的电脑设备(*string字段强制转化bigint*)

需求:
使用资产报表导出离线超过一定时间(一周或者一个月)的电脑设备,筛选项发现没有最近联系时间或者最近启动时间的筛选项

Preview
问题:

报表中可以找到:最近启动时间和最近联系时间,但这两个值所找到的值为字符串类型的毫秒值,不能做longtodate转化。

使用如下方法:
      先转化为数字毫秒值,然后再转为日期格式:

SELECT product.COMPONENTNAME AS "产品", resFields.UDF_CHAR1 AS "IP地址", workstation.LOGGEDUSER AS "最后登录的用户", longtodate(cast(workstation.lastboottime as bigint)) "最近启动时间", longtodate(cast(workstation.lastcontacttime as bigint)) "最近联系时间" FROM SystemInfo workstation LEFT JOIN Resources resource ON workstation.WORKSTATIONID = resource.RESOURCEID LEFT JOIN ComponentDefinition product ON resource.COMPONENTID = product.COMPONENTID LEFT JOIN Resource_Fields resFields ON workstation.WORKSTATIONID = resFields.RESOURCEID