Dynamiczna konwersja łańcucha na nazwę kolumny. MySQL
Mam dwie tabele:items
iorders
items
--------------
id (int) | type_1 (int) | type_2 (int)|
orders
--------------
id (int) | transaction_type enum ('type_1', 'type_2')
Zasadniczo chcę wykonać następujące czynności:
select (select transaction_type from orders where id=1) from items;
Problem polega na tymstring
wrócił przezselect transaction_type from orders where id=1
, nie można przekształcić w nazwę kolumny.