I have two requirements
1) Use table columns names (INFORMATION_SCHEMA.COLUMNS) NOT DATA in where clause query.
2) Transform the final output columns
Table-A:
id column-A column-B column-C ... column-N
1 11 12 13 20
2 21 22 23 20
Table-B:
id name label
1 column A CA
2 column B CB
3 column C CC
RAW MySQL query
select a.* from table A a inner join table B b
where b.name IN (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='Table-A' AND
COLUMN_NAME NOT IN ('id');
ALSO, I want to transform final output of Table-A and that should be:
id CA CB CC
1 11 12 13
2 21 22 23
I don't want column-A column-B column-C in my final query result. Can someone please help me in this?