在Oracle中,我可以选择一个常量值来填充列,如下所示:
Select
"constant" constantvalue,
orders.name
from
orders
它会产生:
ConstantValue Name
constant sandwich
constant burger
无论出于何种原因,当我尝试在postgres中执行此操作时,我收到此错误。
ERROR: column "Constant" does not exist
这是我的代码
select
date_trunc('day', measurement_date + (interval '1 day' * (6 - extract(dow from measurement_date)))) week,
"AROutstanding" colname,
round(avg(Total_Outstanding),0) numbah
from
(
select
measurement_date,
sum(cast(sum_of_dollars as numeric)) Total_Outstanding
from
stock_metrics
where
invoice_status not in ('F','Write off')
group by
measurement_date
) tt
group by
week
答案 0 :(得分:13)
将双引号更改为单引号。
所以这个:
Select
"constant" constantvalue,
orders.name
from
orders
应该是这样的:
Select
'constant' constantvalue,
orders.name
from
orders