您的查询语句中存在一个错误,: 符号在此处不应该出现。请将参数的前缀 :' 改为 :。
修改后的查询语句如下所示:
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 create_time >= TO_DATE(:datetime_start, 'yyyy-mm-dd hh24:mi:ss')
AND create_time < TO_DATE(:datetime_end, 'yyyy-mm-dd hh24:mi:ss')
) total
WHERE 1=1
AND t.FINAL_CHECK_LINE='M1U1'
AND t.create_time >= TO_DATE(:datetime_start, 'yyyy-mm-dd hh24:mi:ss')
AND t.create_time < TO_DATE(:datetime_end, 'yyyy-mm-dd hh24:mi:ss')
GROUP BY
t.FINAL_CHECK_LEVEL, total.total_count;
请注意,你还需要根据实际情况修改其他部分的参数名称和筛选条件,并提供正确的时间范围。
内容由零声教学AI助手提供,问题来源于学员提问




