title: Return values from table a only if it contains corresponding IDs in table b
body: <p>I have tried searching for an answer, but its hard to ask the question or formulate a search to find an answer. So here goes.</p>
  
  <p>I have table A where I store client information, and table B where I store client requests. I am building a search thingy where I want to search for the clients WHERE Bob has helped. Which becomes tricky as I only want 1 row returned per client that Bob has helped. Using a normal join would return multiple rows as there are more than one requests where Bob has helped that client.</p>
  
  <p>See table structure below. (cant add images yet :( )</p>
  
  <p><img src="https://i.stack.imgur.com/PiLGE.jpg" alt="Table setup"></p>
  
  <p>For example, the below query returns multiple rows (5, as there 5 requests attended to by Bob). </p>
  
  <pre><code>SELECT a.ClientName, b.AttendedBy
  FROM TableA A 
  JOIN TableB b ON a.ClientId = b.ClientId
  WHERE b.AttendedBy = 'Peter'
  </code></pre>
  
  <p>So the results I want is below:</p>
  
  <p><img src="https://i.stack.imgur.com/jn3Ns.jpg" alt="Results"></p>
  
  <p>If I want to know which clients Peter attended to then results 1, if I want to know which clients Andrew attended to, then results 2. If I search 'Michael', then NO results must be returned for the client. So nothing basically. Only Show the Client where the 'attendedBy' exists in the client requests (table b).</p>
  
  <p>I have tried multiple things, such as DISTINCT SELECT IN the WHEREclause, STUFF() function, TOP 1, LIMIT, but I am not winning. Assistance would be appreciated. Thanks!</p>
  
  <p>edit:
  p.s, table B and B have other columns with unique values, so using DISTINCT will still return multiple rows for the same client where Peter attended.</p>