Postgresql CASE语句架构错误

时间:2015-07-26 11:57:21

标签: postgresql case

我从以下CASE声明中收到3F000错误。

select 
entity.level1
,   sum(trans_clean.amount_calculated) as total_spend
,   sum(CASE WHEN extract(year from age(supplier.open_date::trans_clean.date_calculated)) <= 5 AND org_type = 'SMALL BUSINESS' THEN trans_clean.amount_calculated END) small_young
,   trans_clean.date_calculated
from
    entity, supplier, trans_clean
where   
    trans_clean.supplier_id = supplier.supplier_id and
    trans_clean.entity_id = entity.entity_id and
date_calculated > '2011-12-01'
group by
    entity.level1
,   total_spend
,   small_young
,   trans_clean.date_calculated
;

错误如下:

ERROR: schema "trans_clean" does not exist
SQL state: 3F000

该声明在没有CASE行的情况下工作,我在PGAdmin III中运行查询,并且肯定选择了正确的模式(公共)。

0 个答案:

没有答案