报表导出时间格式数据多‘0‘

SELECT
   ru.case_number AS 'caseNumber',
    ru.case_desc AS 'caseDesc',
    ru.related_case_number AS 'relatedCaseNumber',
    ru.case_status AS 'caseStatus',
    date_format(ru.create_time, '%Y-%m-%d %H:%i:%s')  as 'createTime',
    date_format((select r.modify_time from ru_cases r where r.case_status = '0' and r.case_number = ru.case_number), '%Y-%m-%d %H:%i:%s')  as 'endTime',
    ru.create_by AS 'createBy'
FROM
 ru_cases ru
WHERE
 ru.validate_state = '1'

问题:

报表导出时间格式数据错误。

原因:

date_format(ru.create_time, '%Y-%m-%d %H:%i:%s')  as 'createTime'未被格式化,格式化后报表导出数据正常。
posted @ 2019-09-02 11:20  不不田鼠  阅读(434)  评论(0编辑  收藏  举报