我正在尝试使以下查询工作:
WITH cte AS (
SELECT org_uid, uid, category, severity, source, created_at,
updated_at, delivery_date, finding_id, client_id, client_note,
definition, recommendations, details, resources, tags, text, type, sub_category,
(SELECT CAST(EXTRACT(EPOCH FROM MAX(fs.remediated_at) - findings.created_at) AS INTEGER) FROM "public"."findings-subjects" fs WHERE fs.finding_uid = findings.uid) AS time_to_remediate
FROM "public"."findings"
WHERE org_uid = '127cb14a-bbbb-dddd-aaaa-451e7cea3f94'
) SELECT org_uid, uid, category, severity, source, created_at, updated_at, delivery_date,
finding_id, client_id, client_note, definition, recommendations, details,
resources, tags, text, type, sub_category, time_to_remediate
WHERE time_to_remediate BETWEEN 3 AND 7
LIMIT 1000
OFFSET 0
字符串
不幸的是,我得到一个错误,说ERROR: column "org_uid" does not exist at character 491
我不知道在查询中的错误在哪里。任何帮助将不胜感激。
1条答案
按热度按时间6tr1vspr1#
您的主查询不包含
FROM
子句。在倒数第三行前加上
FROM cte
;)