Reputation: 9574
I have looked at many SO questions, all of them provide a way for this by hardcoding the column names in the select call. But I need something for all column names.
SELECT * from deviceDetails, connectionDetails where deviceDetails.rowStatus='0' INTO OUTFILE '/tmp/devices.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
I need all the column names. Please help.
Upvotes: 1
Views: 1029
Reputation: 590
If you don't mind tab-separated values, you can try this:
From the linux prompt,
mysql yourdb -B -e "
SELECT * from deviceDetails, connectionDetails where deviceDetails.rowStatus='0';
" > /path/to/file.tsv
The options mean: -B (batch) -e (execute)
Upvotes: 1