我有标识符,我正在为每个标识符提取jobId。这些Jobid是重复的。我想为每个标识符获取唯一的Jobid。
,DISTINCT(res.jobId)
FROM
(
SELECT em.created_at
,em.event_id
,em.identifier
,em.lbb_diag_type
,em.lbb_diag_value
,em.model
,em.sw_pkg_version
,(CASE WHEN NULLIF(JSON_EXTRACT_PATH_TEXT(em.lbb_diag_value,'execution','status',true),'') = 'QUEUED' THEN 'Queued'
ELSE NULL END) AS status
,(CASE WHEN status = 'Queued' THEN NULLIF(JSON_EXTRACT_PATH_TEXT(em.lbb_diag_value,'execution','jobId',true),'')
ELSE NULL END) AS jobId
,(CASE WHEN NULLIF(JSON_EXTRACT_PATH_TEXT(em.lbb_diag_value, 'execution', 'jobDocument', 'type', true), '') = 'camera-format' THEN 'CameraFormat' ELSE NULL END) AS type_camera_format
FROM eld_messages em
WHERE status = 'Queued'
AND em.created_at >= getdate()-30
AND em.type = 'lbb_diag'
AND em.lbb_diag_type = 'sra_diag'
AND type_camera_format IS NOT NULL
) res
但是我在DISTINCT遇到错误。