Dynamische Konvertierung des Strings in den Spaltennamen. MySQL

Ich habe zwei Tische:items undorders

items
--------------
id (int) | type_1 (int) | type_2  (int)|

orders
--------------
id (int) | transaction_type enum ('type_1', 'type_2')

Grundsätzlich möchte ich Folgendes tun:

select (select transaction_type from orders where id=1) from items;

Das Problem ist also, dassstring zurückgegeben vonselect transaction_type from orders where id=1, kann nicht in Spaltennamen konvertiert werden.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage