I have a problem I can not solve and found no solutions on the web. I have two database tables (in postgresql).
Table_A is the real dataset:
date; var_1; var_2; var_3; var_4; var_5; ....; var_100
03-10-14; A; 15; B; 10; 7; ...; TT
04-10-14; U; 67; G; 9; 99; ...; LLK
etc
etc
Table_B is the "metadata":
var; long_name; type; use;
date; Date of transaction; DATE; yes
var_1; Type of customer; ATTRIBUTE; yes
var_2; Age; NUMBER; yes
etc
ect
So each column of table_A has the metadata definied in a row of table_B
Now the problem:
I want to write a query in php that returns the data of table_A with ONLY the column defined as DATE in table_B and each one of the columns defined as ATTRIBUTE en table_B.
Obviously I want to perform this dynamically (I do not want to write the query when the tables change...)
I tried many approaches I succeeded with the DATE column and ONE ATTRIBUTE, but not all.
Any ideas? THANKS in advance