【发布时间】:2017-02-07 19:50:58
【问题描述】:
我有一个选择查询,我的列类型是文本,然后我使用查询将其转换为整数
select case
when fti.status!='not signed' then 1::integer
when ftrq.is_the_site_cleared = '1' then 1::integer
when ftrq.is_the_site_cleared = '0' then 0::integer
end as is_the_site_cleared from fti join ftrq on ftrq.fulcrum_parent_id = fti.fulcrum_id
我确实有很多这样的列,并且希望将它们的总数作为列中的最后一个值,这可能类似于底部的 sum(is_the_site_cleared )。我怎样才能做到这一点?我正在使用 postgresql 9.3,它说 sum(text) 函数不存在。请帮忙!!!
【问题讨论】:
标签: postgresql