我正在使用PostgreSQL和Pentaho数据集成。我正在执行查询:
SELECT
t.VAL_1 as Contract,
t.VAL_2 as Calender,
t.VAL_3 as MSPProvider,
t.VAL_4 as MSPCustomer,
t.VAL_5 as Severity,
t.VAL_6 as Relation,
t.VAL_7 as Target,
t.VAL_8 as TargetUnit,
t.VAL_9 as TargetPeriod,
t.VAL_10 as CalculationType,
t.VAL_11 as working_days,
t.VAL_12 as time_of_day
FROM t_slalom_outputs t
WHERE t.is_active = 1 and t.table_name = 'contract_target_mapping';
错误说:
ERROR: column t.val_1 does not exist
LINE 1: select t.VAL_1 as Contract,
^
********** Error **********
ERROR: column t.val_1 does not exist
SQL state: 42703
Character: 8
如果我使用带引号的逗号来编写查询,即
SELECT
't.VAL_1' as Contract,
't.VAL_2' as Calender,
't.VAL_3' as MSPProvider,
't.VAL_4' as MSPCustomer,
't.VAL_5' as Severity,
't.VAL_6' as Relation,
't.VAL_7' as Target,
't.VAL_8' as TargetUnit,
't.VAL_9' as TargetPeriod,
't.VAL_10' as CalculationType,
't.VAL_11' as working_days,
't.VAL_12' as time_of_day
FROM t_slalom_outputs t
列名(t.val_1,t.val_2.....t.val_12)
将填充在列值中,列名称为别名(合同,日历.......时间)。我想执行第一个查询,但无法摆脱错误。我是PostgreSQL的noobie。我认为语法有些错误。任何帮助将不胜感激。