Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

MySQL JOIN para substituir IDs por valor de outra tabela


Perto, mas não charuto:
SELECT 
  FromEnc.EncodingName AS FromEncoding, 
  ToEnc.EncodingName AS ToEncoding
FROM EncodingMapping
INNER JOIN Encoding AS FromEnc
  ON FromEnc.ID=EncodingMapping.EncodingFromId_FK
INNER JOIN Encoding AS ToEnc
  ON ToEnc.ID=EncodingMapping.EncodingToId_FK
WHERE EncodingMapping.ItemId_FK = 45