Need help for fetching Alias names for columns of a view from Reference table
I have a requirement as per which I have a reference table which contains names of the KPIs against the KPI_ID.Sample structure of this table along with data is :
new to bank customers
cash loan customers
I have another table which contains the above mentioned KPI_IDs as individual columns having value for each KPI_ID.Sample structure along with data for this is:
Now,my requirement is to create a view,which on running gives me output in the following manner:
new to bank cust
cash loan cust
i.e. the column names for columns kpi_1 and kpi_2 should be replaced by there respective kpi_name in the view and for this I have to use reference table(i.e. table1) and it has not to be implemented by hard coding alias names because as per my requirement the kpi_name can cahnge in the reference table(table1) and the same should reflect in the result when I run a select on the view.
In short :
"create or replace view test_view as
,kpi_1 "new to bank cust"
,kpi_2 "cash loan cust"
from table 2" should not be the solution.
the alias name for kpi_1,kpi_2 should come from reference table (table1).
Please help me as to how to implement it in teradata.Its an urgent requirement.