列不存在使用posgresql中的案例语句
我正在尝试计算PostgreSQL中每个年龄范围的付款。
select
case
when age < 50 then "0-50"
else "50+"
end as age_range,
SUM(payment_amount) as sum_payment_amount
from
(
select
age,
payment_amount
from
"002_DM_clients" dc
left join user_payment_log upl
on
dc.client_id = upl.client_id
) query1
group by
age_range;
但是我会收到以下错误:
Error executing query:
SQL Error [42703]: ERROR: column "0-50" does not exist
我不知道问题可能是什么。
I am trying to calculate the payments for each age range in PostgreSQL.
select
case
when age < 50 then "0-50"
else "50+"
end as age_range,
SUM(payment_amount) as sum_payment_amount
from
(
select
age,
payment_amount
from
"002_DM_clients" dc
left join user_payment_log upl
on
dc.client_id = upl.client_id
) query1
group by
age_range;
But I get the following error:
Error executing query:
SQL Error [42703]: ERROR: column "0-50" does not exist
I have no idea what the problem could be.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论