title: Complement of a SQL Join? T-SQL help needed
body: <p>I will try to make my question sound as unconfusing as possible. I appologize in advance for any wording mistakes as I try to phrase my question as best as I can:</p>
  
  <p>Using T-SQL I need to write a join statement that gets me all the results that have a match in table A and table B</p>
  
  <p>AND (!)</p>
  
  <p>another join statement (or a continuation of the first join) that returns all the results from table A that DID NOT have a match in table B, BUT in this second result set I need to have one of the columns set to "N/A" to identify the records that didn't have a match.</p>
  
  <p>In other words, I need something that would return everything in table A but would also identify the rows that weren't matched in B. That information is then used in a report.</p>
  
  <p>Here is what I have so far:</p>
  
  <p>I have the first part done:</p>
  
  <pre><code>LEFT OUTER JOIN dbo.chart B
  ON B.UserName = A.user_name
  </code></pre>
  
  <p>That gets me the matching records and just the matching records</p>
  
  <p>I tried adding this second join:</p>
  
  <pre><code>JOIN dbo.chart
  ON NOT EXISTS (select * from B.UserName = A.user_name)
  </code></pre>
  
  <p>Hoping it would get me the non-matching records (I was planning to then use REPLACE on the column of interest to label that column "N/A") but there is something clearly wrong with my synthax as that generates exceptions.</p>
  
  <p>My question is what do I need to change to get me the results you need. I do know that I need to have at least one join as I have other part of the query to work with. I just don't know if I need to have that one join return both sets of data of I actually do need a second one just for the non-matching records.</p>
  
  <p>Hope this wasn't too confusing. Any help would be greatly appreciated.</p>
  
  <p>Thank you!</p>
  
  <p><strong>Update: I would just like to emphasize that the reason I considered using a second join instead of getting all of the results at once is because I need to correctly identify and label those rows that weren't matched within everything that I get back.</strong></p>