DATE_PART
当我在此查询 的函数中减去两个日期时,我遇到了问题。
SELECT
TO_CHAR(date_trunc('month',sql_activity_days.created_month),'YYYY-MM') AS "sql_activity_days.created_month",
coalesce(SUM(
CASE
WHEN(date_part('day', (sql_activity_days.sale_date + 1) - sql_activity_days.start_date) < 122)
THEN sql_activity_days.cad_net_invoiced
ELSE NULL
END
),0) AS "sql_activity_days.activity_over_122_day_after_signup"
FROM
camel.f_subscription_touch AS subscription_touch
LEFT JOIN sql_activity_days ON subscription_touch.id = sql_activity_days.customer_id
group by date_trunc('month',sql_activity_days.created_month)
order by 1 desc limit
500
PostgreSQL 数据库在运行此查询时遇到错误。
错误:函数 date_part(unknown, integer) 不存在 提示:没有函数匹配给定的名称和参数类型。您可能需要添加显式类型转换。职位:1340