SELECT action param params device_id date_start date_end UNION ALL SEL

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
SELECT 'action', 'param', 'params', 'device_id', 'date_start', 'date_end'
UNION ALL
SELECT
`action`,
`param`,
`params`,
`device_id`,
`date_start`,
`date_end`
FROM statistic_prolonged_partition
WHERE `date_start` BETWEEN '2019-10-01 00:00:00' AND '2019-10-31 23:59:59'
INTO OUTFILE '/Users/lloyd/prolonged.csv'
FIELDS TERMINATED BY ','
ESCAPED BY ''
LINES TERMINATED BY '\n'