title: Get summary output using joins in SQL
body: <p>I have the following table structure also I have mention my expected output please help me with query as I don't know much about SQL query</p>
  
  <p>Following is the table structure</p>
  
  <pre><code>select Id,DocumentName from dbo.JoinigDocument
  
  Id  DocumentName
  1   Exp letter
  2   birth cert
  3   Leaving
  </code></pre>
  
  <p>Table  2:</p>
  
  <pre><code>SELECT * FROM dbo.EmployeeJoiningDocument
  
  Id  JoiningDocumentId   EmployeeId
  1       1                 1
  2       3                 1
  3       1                 2
  4       2                 2
  5       3                 2
  6       1                 3
  </code></pre>
  
  <p>Table 3 :</p>
  
  <pre><code>select Id,FName  from dbo.EmployeeDetail
  
  Id  FName
  1   Pratik
  2   Nilesh
  3   Praveen
  </code></pre>
  
  <p>Expected Output:-</p>
  
  <pre><code>DocumentName    FName       Present
  
  Exp letter      Pratik      1
  birth cert      Pratik      0
  Leaving         Pratik      1
  Exp letter      Nilesh      1
  birth cert      Nilesh      1
  Leaving         Nilesh      1
  Exp letter      Praveen     1
  birth cert      Praveen     0
  Leaving         Praveen     0
  </code></pre>