INTO OUTFILE command saves file without header, how to set header?

Asked

Viewed 156 times

0

Good afternoon, everyone,

I am running the following command to save files coming from MYSQL.

Works however I cannot save the file with header, the data comes without header.

SELECT *
INTO OUTFILE 'C:/Users/ADAMLINCOLNOLIVEIRAS/Box Sync/Sustain/arquivo1.csv'
FIELDS TERMINATED BY ';'
FROM Agentes

Someone has a suggestion to help me ?

1 answer

0

I found the exit.

SELECT "ID", "AGENT" UNION ALL SELECT ID_AGENTE, NM_AGENTE INTO OUTFILE 'C:/Users/ADAMLINCOLNOLIVEIRAS/Box Sync/Sustain/arquivo2.csv' FIELDS TERMINATED BY ';' FROM Agents

In bold I created a false output where I put the column name in the same query sequence.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.