title: SQL where both conditions in brackets are true
body: <pre><code>SELECT
      *
  FROM 
      TableName
  WHERE
      Column1 = 'X'
      AND Column2 = 'Y'
      AND (Column3 != 'D' AND Column4 != 'D') -- Want to apply this filter ONLY if both conditions are true
  </code></pre>
  
  <p>How to write third filter so that it's applied only if both of them are true. Currently, brackets make no difference but I need expression in brackets to be considered as a single condition</p>
  
  <p>Example:</p>
  
  <pre><code>Column1     Column2     Column3     Column4
  X           Y           D           L   
  X           Y           L           L   
  X           Y           L           D   
  X           Y           D           D   -- want to remove this line
  </code></pre>
  
  <p>Result should be:</p>
  
  <pre><code>Column1     Column2     Column3     Column4
  X           Y           D           L   
  X           Y           L           L   
  X           Y           L           D   
  </code></pre>