COPY (SELECT aicraft.id,auto.uri, auto.expires_at, auto.created_at, auto.updated_at
FROM aicraft LEFT OUTER JOIN aicraft ON aicraft_id = auto.id ) TO '/tmp/stst.csv' ;
SELECT
aicraft.id,auto.uri, auto.expires_at, auto.created_at, auto.updated_at
FROM aicraft
LEFT OUTER JOIN aicraft ON aicraft_id = auto.id
INTO OUTFILE '/tmp/result.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'