title: Duplication issue in mysql query add time difference condition
body: <p>I have this query which i use to match two tables.</p>
  
  <p>What is happening here is that i get duplicated rows..
  There should appear 10 rows instead there appear 15..
  Could you please tell me what am i doing wrong?</p>
  
  <p>Could someone please help me with adding a new condition?
  Putting </p>
  
  <pre><code>i.`time`- r.`time` is between 01:00:00 and 01:05:00
  </code></pre>
  
  <p>Thanks..</p>
  
  <pre><code>$data = mysql_query( "select r.`time`, r.`epos_id`,r.`basket_value`, r.`date`,re.`location`,i.`user_id`,i.`mobile_number`,
         i.`time`, i.`rbpos_id`, i.`date`
  from retailer r
  join rbpos_epos re on r.epos_id = re.epos_id
  join imovo i on i.rbpos_id = re.rbpos_id
               and addtime(r.`time`, '01:05:00') &gt; i.`time`
               and r.`time` &lt; i.`time`
               and r.`date` = i.`date`;
  ") 
   or die(mysql_error()); 
   Print "&lt;table border cellpadding=3&gt;"; 
    Print "&lt;tr&gt;"; 
   Print "&lt;th&gt;Date:&lt;/th&gt;
  &lt;th&gt;Time&lt;/th&gt;
  &lt;th&gt;Location&lt;/th&gt;
  &lt;th&gt;User ID&lt;/th&gt; 
  &lt;th&gt;Basket Value&lt;/th&gt; 
  &lt;th&gt;Mobile Number&lt;/th&gt;"; 
    Print "&lt;/tr&gt;";
   while($info = mysql_fetch_array( $data )) 
   { 
  
     Print "&lt;tr&gt;"; 
   Print " &lt;td&gt;".$info['date'] . "&lt;/td&gt;
  &lt;td&gt;".$info['time'] . " &lt;/td&gt;
  &lt;td&gt;".$info['location'] . " &lt;/td&gt;
  &lt;td&gt;".$info['user_id'] . " &lt;/td&gt;
  &lt;td&gt;".$info['basket_value'] . " &lt;/td&gt;
  &lt;td&gt;".$info['mobile_number'] . " &lt;/td&gt;
  &lt;/tr&gt;"; 
  </code></pre>