Mysql
 sql >> Database >  >> RDS >> Mysql

MySQL:come convertire in EAV?

Presumo che two.id sia un numero intero a incremento automatico, quindi lo lascerò alla tabella di destinazione per assegnare quei valori.

select id as fk_id, 'first_name' as attribute, first_name as value
from one
union all
select id as fk_id, 'last_name', last_name
from one
order by fk_id, attribute