title: What will be the correct query?
body: <p>Im trying to figure out how my query should look like.<br></p>
  
  <p>With this query i <code>select * from usr_time_reg</code><br>
  <code>WHERE usr_time_nr = '$usr_time_nr' AND usr_stamp_in LIKE '$y_m'</code><br></p>
  
  <p>So far, so good!<br>
  Now i'd like to also select <code>usr_stamp_in WHERE usr_stamp_in = '0000-00-00 00:00:00' AND usr_stamp_out = '$y_m</code></p>
  
  <p>How should that query look like?<br>
  Query downunder is selecting ALL <code>usr_stamp_in</code> that contains '0000-00...'<br> I still need the filtering with "time_nr &amp; y_m"!</p>
  
  <pre><code>//Make the Select in mysql
  $query = "SELECT * FROM usr_time_reg
                     WHERE usr_time_nr = '$usr_time_nr' AND usr_stamp_in LIKE '$y_m'
                     OR usr_stamp_in = '0000-00-00 00:00:00' AND usr_stamp_out LIKE '$y_m'
                     ORDER BY usr_stamp_in DESC";
  </code></pre>
  
  <p>Variables</p>
  
  <pre><code>$y_m = "2015-03%";
  $time_nr = "1";
  </code></pre>
  
  <p><strong>db</strong></p>
  
  <pre><code>ID  time_nr        stamp_in                stamp_out
  1    1        2015-03-03 06:00:00     2015-03-03 15:30:00
  2    1        0000-00-00 00:00:00     2015-03-04 15:30:00
  3    1        2015-03-03 06:00:00     0000-00-00 00:00:00
  </code></pre>