title: DB2 SQL *basic* SELECT statement w/ two conditions
body: <p>I am trying to generate a report that shows records from a single table that meet either of two conditions:</p>
  
  <p>1) "D" = 'ERR' and the record is less than a week old.</p>
  
  <p>-- OR --</p>
  
  <p>2) "D" = 'X' OR 'Y'  AND the record is more than one hour old.</p>
  
  <p>I have started out with requirement #1, but I don't know how to perform both requirements in the same query with the right logic applied. For the record to be display on the report, either of the two conditions can be applicable, and the condition #2 actually needs to have an OR operator as well.</p>
  
  <p>I'm probably going to change this report to work from the past X hours (1/2/4/8) as well, but I am sure another post on this site addresses that question.</p>
  
  <pre><code>   SELECT "A", "B", "C"
       FROM Schema."Table" 
      WHERE "D"='ERR' AND TimeStamp &gt;= (CURRENT_TIMESTAMP - 7 DAYS)
   ORDER BY TimeStamp DESC
  </code></pre>