title: SQL statement to conditionally select related records
body: <p>I have a table with fields <code>id</code> (primary key) and <code>fid</code>.  I want to get the record where <code>id</code> matches a particular value, as well as all related records that have its same <code>fid</code> value.</p>
  
  <p>I can do this:</p>
  
  <pre><code>SELECT * FROM mytable 
  WHERE fid = (SELECT TOP 1 fid FROM mytable WHERE id = 'somevalue')
  </code></pre>
  
  <p>But I don't want the related records if the <code>fid</code> is a particular value (in my case an empty guid value).</p>
  
  <p>Is there a way to do this in a single SQL statement?  I am using SQL Server 2008 R2.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Looking at the answers so far I think I may not have asked my question clearly.  <code>id</code> and <code>fid</code> will never be equal.  <code>LEFT JOIN</code> may be what I need, but I'm a bit SQL ignorant.  What I'm hoping for is the following two queries as a single statement:</p>
  
  <pre><code>SELECT * FROM mytable WHERE id = 'somevalue' 
  
  SELECT * FROM mytable WHERE fid = 
      (SELECT TOP 1 fid FROM mytable 
       WHERE id = 'somevalue' AND fid != '00000000-0000-0000-0000-000000000000')  
  </code></pre>