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

Unire due tabelle senza restituire una riga indesiderata

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