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.
The data is as below:
TIMESTAMP VALUES
1436846660 10
1436846661 10
1436846662 10
1436846663 10
1436846664 10
For user entered interval 2
, expected result is :
TIMESTAMP VALUES
1436846660 10
1436846662 10
1436846664 10
I am using the following command to get the data from starttime
to stoptime
SELECT
`VALUES`
INTO
OUTFILE 'FILEPATH'
FIELDS TERMINATED BY ''
LINES TERMINATED BY '
'
FROM
TABLENAME
WHERE
TABLENAME.TIMESTAMP >=starttime
AND TABLENAME.TIMESTAMP <=stoptime;
So, how should I modify this code to include only those data between starttime
and stoptime
with the particular interval. Please provide me a solution.