在下面查詢的,我不能夠使用1111(HY000):無法使用組功能|無法使用組功能THEN欄目查詢
THEN count(DISTINCT(workflow_link.email_api_response_packets.parent_id))
語法,任何幫助,在此表示讚賞。
SELECT workflow_link.email_api_response_packets.subscriber_id
, count(DISTINCT(workflow_link.email_api_response_packets.parent_id)) as cnt
, SUM(CASE WHEN (workflow_link.email_api_response_packets.action = 'O'
AND workflow_link.email_api_response_packets.parent_id IS NOT NULL
THEN count(DISTINCT(workflow_link.email_api_response_packets.parent_id))
ELSE 0
END)*100/SUM(CASE WHEN (workflow_link.email_api_response_packets.id
AND workflow_link.email_api_response_packets.parent_id IS NULL)
THEN 1
ELSE 0
END) AS percentage
FROM workflow_link.email_api_response_packets
WHERE workflow_link.email_api_response_packets.updated_at >= 1403929223
AND workflow_link.email_api_response_packets.updated_at <= 1503929479
AND workflow_link.email_api_response_packets.list_id IN (400)
AND workflow_link.email_api_response_packets.is_test = 0
GROUP BY workflow_link.email_api_response_packets.subscriber_id
HAVING percentage >= 0
你試過計數(DISTINCT工作流程...)嗎? (即沒有內部支架) – etsa
在第一個「CASE WHEN」時出現括號問題:在WHEN部分之後打開它,但在END之後關閉它。所以在'IS NOT NULL'之後缺少一個括號。 – waka
@etsa,謝謝你的評論我已經試過建議的方式,但沒有運氣同樣的錯誤 – Abhishek