sql >> Base de Datos >  >> RDS >> Mysql

Unir dos tablas sin devolver una fila no deseada

SELECT 
  IssueID, 
  AssignedID, 
  CreatorID, 
  AssignedUser.real_name AS AssignedName, 
  CreatorUser.real_name AS CreatorName
FROM Issues
  LEFT JOIN Users AS AssignedUser
         ON Issues.AssignedID = AssignedUser.UserID
  LEFT JOIN Users AS CreatorUser
         ON Issues.CreatorID = CreatorUser.UserID
ORDER BY `issueid` ASC
LIMIT 0, 30