title: SQL Query Where Clause for Null OR Match (only return 1)?
body: <p>I have a table that has records with a structure similar to this..</p>
  
  <p>ID    RoleID<br>
  1     NULL<br>
  2     15<br>
  3     16  </p>
  
  <p>I wrote a where clause to get records like the following</p>
  
  <pre><code>SELECT * from TableX 
  WHERE (RoleID = 2 OR RoleID IS NULL)
  </code></pre>
  
  <p>This gets me the record of "1,NULL"</p>
  
  <p>But if i query  </p>
  
  <pre><code>SELECT * from TableX 
  WHERE (RoleID = 15 OR RoleID IS NULL)
  </code></pre>
  
  <p>I get back "1,NULL" and "2,15".  </p>
  
  <p>Does anyone know how to structure a select to give me only one record?  I only want "2,15" if 15 was passed and "1,NULL" if there are no matches.  </p>
  
  <p>Note, the actual query has MANY more where clauses to it, so nesting itself inside itself would be a very big query.</p>