Conversão dinâmica de string no nome da coluna. MySQL
Eu tenho duas mesas:items
eorders
items
--------------
id (int) | type_1 (int) | type_2 (int)|
orders
--------------
id (int) | transaction_type enum ('type_1', 'type_2')
Basicamente, quero fazer o seguinte:
select (select transaction_type from orders where id=1) from items;
Então, o problema é questring
retornado porselect transaction_type from orders where id=1
, não pode ser convertido no nome da coluna.