title: SQL WHERE Clause Criteria
body: <p>Having a Friday moment...trying to write MySQL criteria as follows:</p>
  
  <p>A timestamp between two dates
  ALSO, the timestamp is not greater than 23:59 if field2 is a or b</p>
  
  <p>Something like:</p>
  
  <pre><code>(`timestamp` BETWEEN @StartDate And @EndDate) AND NOT ((`timestamp`&gt;='23:59') AND (`Field2` NOT IN ('a','b')))
  </code></pre>
  
  <p>This looks a bit off to me, and is showing the error character in my editor, so I'm trying to determine if this form is wrong, or if I've miscounted parentheses somewhere. I'm actually performing some calculations on the timestamp field, but have omitted those for simplicity's sake.</p>
  
  <p>Any insights are appreciated!</p>