您的查询语句中存在一个错误,> 符号在此处不应该出现。请将最后一行的 > 符号删除。
修改后的查询语句如下所示:
SELECT
t.FINAL_CHECK_LEVEL,
COUNT(*) AS level_count,
ROUND((COUNT(*) / total.total_count), 3) * 100 AS percentage,
CASE WHEN uu.original_order IS NOT NULL OR uu.original_order <> '' THEN uu.original_order ELSE u.work_order_name END AS workorder
FROM
UDT_FINAL_TEST_DATA t
LEFT JOIN TM_UNIT u ON u.name = t.unit_name
LEFT JOIN UDA_UNIT uu ON u.id = uu.id,
(
SELECT COUNT(*) AS total_count FROM UDT_FINAL_TEST_DATA
WHERE 1=1
AND FINAL_CHECK_LINE='M1U1'
{ AND FINAL_CHECK_LINE IN (:check_line) }
AND create_time >= TO_DATE(:'2024-03-18 14:26','yyyy-mm-dd hh24:mi:ss')
AND create_time < TO_DATE(:'2024-03-19 20:26', 'yyyy-mm-dd hh24:mi:ss')
) total
WHERE 1=1
AND t.FINAL_CHECK_LINE='M1U1'
AND t.create_time >= TO_DATE(:'2024-03-18 14:26','yyyy-mm-dd hh24:mi:ss')
AND t.create_time < TO_DATE(:'2024-03-19 20:26', 'yyyy-mm-dd hh24:mi:ss')
GROUP BY
t.FINAL_CHECK_LEVEL, total.total_count;
请注意,您还需要根据实际情况修改其他部分的参数值和筛选条件。
内容由零声教学AI助手提供,问题来源于学员提问




