title: Retrieve data from database in specific interval into a file
body: <p>In database, I have stored data in one second interval, but I want to retrieve the stored data into a file in some particular interval entered by the user.
  <br>
  <br>
  The data is as below:</p>
  
  <pre><code>TIMESTAMP   VALUES
  1436846660  10
  1436846661  10
  1436846662  10
  1436846663  10
  1436846664  10
  </code></pre>
  
  <p>For user entered interval <code>2</code>, expected result is :</p>
  
  <pre><code>TIMESTAMP   VALUES
  1436846660  10
  1436846662  10
  1436846664  10
  </code></pre>
  
  <p>I am using the following command to get the data from <code>starttime</code> to <code>stoptime</code></p>
  
  <pre><code>SELECT
      `VALUES`
  INTO
      OUTFILE 'FILEPATH'
      FIELDS TERMINATED BY ''
      LINES TERMINATED BY '\n'
  FROM
      TABLENAME
  WHERE
          TABLENAME.TIMESTAMP &gt;=starttime
      AND TABLENAME.TIMESTAMP &lt;=stoptime;
  </code></pre>
  
  <p>So, how should I modify this code to include only those data between <code>starttime</code> and <code>stoptime</code> with the particular interval. Please provide me a solution.</p>