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

Multiple Inner Join cancellano gli attributi

SELECT a.*, 
   CONCAT(p.firstname, ' ', p.lastname) AS Author,  
   CONCAT(p1.firstname, ' ', p1.lastname) AS Composer, 
   CONCAT(p2.firstname, ' ', p2.lastname) AS Featured FROM albums a
INNER JOIN people p ON a.idauthor = p.id
INNER JOIN people p1 ON a.idcompositor = p1.id
INNER JOIN people p2 ON a.idfeat = p2.id
where a.idalbum=:id

Quindi potrai accedere a Autore, Compositore e In primo piano, oltre a tutte le proprietà dell'album