非常抱歉,是我在SQL语句中写错了GROUP BY字段。应该将t.uuid改为t1.uuid。以下是正确的SQL语句:
SELECT
t1.uuid AS uuid,
IFNULL(t1.eventLevel, 7) AS eventLevel,
t8.`name` AS eventLevelStr,
t1.STATUS AS eventStatus,
CASE t1.STATUS
WHEN 1 THEN '待处理'
WHEN 2 THEN '处理中'
WHEN 3 THEN '已关闭'
ELSE ''
END AS eventStatusStr,
t1.safeStatus AS notifyStatus,
CASE t1.safeStatus
WHEN 1 THEN '已通报'
ELSE '未通报'
END AS notifyStatusStr,
FROM_UNIXTIME(t1.createTime) AS happenedTime,
t1.createTime AS happenedTimeStamp,
t4.name AS ruleName,
t4.type AS ruleType,
CASE t4.type
WHEN 1 THEN '登录'
WHEN 2 THEN '改密'
WHEN 3 THEN '添加'
WHEN 4 THEN '锁定'
WHEN 5 THEN '开启'
ELSE ''
END AS ruleTypeStr,
t6.uuid AS assetUuid,
t6.itcompName AS assetName,
t6.controlAdderss AS ip,
t1.eventMessage AS eventContent,
t1.dealUser AS handlerUuid,
t7.user_real_name AS handlerName,
t9.taskUuid AS safeOrderUuid,
t10.citype_Name AS assetType,
t1.logSourceUuid
FROM
circumambulation_strategy_event_info t1
INNER JOIN circumambulation_strategy_info t4 ON t4.uuid = t1.strategyUuid
INNER JOIN t_monitor_itcomp t6 ON t6.uuid = t1.logSourceUuid
INNER JOIN t_user_info t7 ON t7.uuid = t1.dealUser
INNER JOIN event_level_config t8 ON t8.`value` = IFNULL(t1.eventLevel, 7)
LEFT JOIN ca_common.safe_order t9 ON t9.incidentUuid = t1.uuid
LEFT JOIN t_cmdb_citype t10 ON t6.citypeUuid = t10.uuid
GROUP BY
t1.uuid
ORDER BY
t