title: Query not returning NULL values - SQL
body: <p>I've been trying for awhile by changing my query around but no LUCK! I have tables:</p>
  
  <pre><code>Demographic
  ( name, gender, nationality, ethnicity etc)
  Reference
  (ID, Code as varchar, Description varchar)
  </code></pre>
  
  <p>Basically I add all my values in the <code>reference</code> table like <code>nationality, Gender, ethnicity</code> then I link it to <code>demographics</code>, eg. <code>ID:1 , Code: Gender , Description: Male</code></p>
  
  <p>So in <code>demographics</code> any <code>male</code> will have value <code>1</code> ( the <code>Reference.ID</code>)</p>
  
  <p>I've written this query:</p>
  
  <pre><code>Select Id, fname, Surname
           ,e.Description as Nationality
           ,a.Description as Gender
  FROM Demographics d, Reference e, Reference a
  WHERE (d.Nationality = e.ID OR d.Nationality IS NULL) AND (d.Gender = a.ID OR 
  d.Gender IS NULL)
  </code></pre>
  
  <p>Without the IS NULL parts it works but it excludes all NULL values. But when I add IS NULL it returns <strong>inaccurate</strong> values like <strong>in Gender column I will have ethnicity values</strong>.</p>
  
  <p>Any help will be appreciated.</p>