Conversión dinámica de cadena en nombre de columna. MySQL
Tengo dos mesas:items
yorders
items
--------------
id (int) | type_1 (int) | type_2 (int)|
orders
--------------
id (int) | transaction_type enum ('type_1', 'type_2')
Básicamente, quiero hacer lo siguiente:
select (select transaction_type from orders where id=1) from items;
Entonces, el problema es questring
devuelto porselect transaction_type from orders where id=1
, no se puede convertir en nombre de columna.