how to remove duplicate record from results doing left join in sql :     I have three tables User Table,Enquiry table and Activity Table .when I do a inner and LEFT JOIN, I am getting duplicate records because of NULL values.

        User Table -1
  
        
            user_id | user_firstName | user_lastName
            
            1         | Joe            | Smith
            
            2         | John           | Doe
            
            3          | Robert         | Smith
            
            Enquiry Table -2 
            
            
            EnquiryID  | CreatedBy| |  
            1          |     1      |    
            2          |     1      |     
        
        Activiy Table - 3 
        
        
        ActivityID | CreatedBy| AssignedBy| AssignedTO| 
        
        1          |     1     |    null   |  null     | 
        
        2          |     1    |      2     |   3       |
        
        Expected Output of all three combining result is 
        
        Enquiry ID |  | CreatedBy| AssignedBy| AssignedTO| 
        
        1          |     Joe     |    null   |  null     | 
        
        2          |     Joe  |      John     |   Rober  |
    
    SQL:
    
    SELECT DISTINCT E.EnquirdID as Enquiry,U.FirstName as CreatedBY ,U1.FirstName as AssignedBY  , U2,FirstName as AssignedTO 
    FROM Enquiry E inner join User U on E.UserID = U.UserID 
                   inner join Activity A on E.Enquiry = A.EnquiryID
                   Left Join User U1  on A.AssignedBY = U1.UserID 
                   Left Join User U2 on  A.AssignedTO = U2.UserID
    
    I am getting duplicate Enquiry record  from above query even though using Distinct for EnquiryID
END RESULT: My plan is to use the SQL to select the data and display it in PHP on a website. It's a Enquiry management website. I want to be able to have PHP pull the variables from SQL so I can use them however I feel fit.

