I am using PostgreSQL with Pentaho Data Integration. I am executing a query:
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';
The error says:
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
If I write my query using quoted commas ie.
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
The column name (t.val_1,t.val_2.....t.val_12)
gets populated in the column values with column names as the alias names (contract, calendar.......Time Of Day). I want to execute the first query but can't get rid of errors. I am noobie at PostgreSQL. I think there's some error with the syntax. Any help will be much appreciated.