Error: column does not exist when in fact it does? why?
Error: column does not exist when in fact it does? why?
我在下面有以下 PostgreSQL 查询。如果我删除一行 AND r.type = "long_form"
它工作正常。我不确定为什么 PostgreSQL 不喜欢那一行:
SELECT TRUNC(DATE_PART('day', CURRENT_DATE - r.created_at )/7) AS weeks_ago,
date(min(r.created_at)) AS "Date Start",
date(max(r.created_at)) AS "Date End",
count(*) as "Reviews in Cohort",
AVG(has_note::int) as "Reviews w 1 or more Notes Ratio"
FROM (SELECT r.id, r.created_at,
( MAX(rn.note) IS NOT NULL ) as has_note
FROM reviews f JOIN
reviewss_notes rn
ON r.id = rn.review_id
WHERE r.completed_at IS NOT NULL
AND r.created_at > '2019-01-01'
AND r.type = "long_form"
GROUP BY r.id
) f
GROUP BY weeks_ago
ORDER BY weeks_ago DESC;
这是导致问题的查询行:
AND r.type = "long_form"
table的设计包括一列:
我做错了什么?
检查你的引用字符...
AND r.type = 'long_form'
使用单引号表示字符串常量。
我在下面有以下 PostgreSQL 查询。如果我删除一行 AND r.type = "long_form"
它工作正常。我不确定为什么 PostgreSQL 不喜欢那一行:
SELECT TRUNC(DATE_PART('day', CURRENT_DATE - r.created_at )/7) AS weeks_ago,
date(min(r.created_at)) AS "Date Start",
date(max(r.created_at)) AS "Date End",
count(*) as "Reviews in Cohort",
AVG(has_note::int) as "Reviews w 1 or more Notes Ratio"
FROM (SELECT r.id, r.created_at,
( MAX(rn.note) IS NOT NULL ) as has_note
FROM reviews f JOIN
reviewss_notes rn
ON r.id = rn.review_id
WHERE r.completed_at IS NOT NULL
AND r.created_at > '2019-01-01'
AND r.type = "long_form"
GROUP BY r.id
) f
GROUP BY weeks_ago
ORDER BY weeks_ago DESC;
这是导致问题的查询行:
AND r.type = "long_form"
table的设计包括一列:
我做错了什么?
检查你的引用字符...
AND r.type = 'long_form'
使用单引号表示字符串常量。