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

MySQL JOIN per sostituire gli ID con il valore di un'altra tabella

Chiudi, ma non sigaro:

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