I have some tables that contain fields with double quotes in them, but they are part of a name or abbreviation for "inches", the " do NOT escape the field.
I need to export this to a CSV file but MySQL keeps breaking the fields at the " and creating extra columns in the CSV. How can I handle " within a field value?
Code:
select
makers.maker_name,
baits.bait,
depth_line.depth,
depth_line.lineout a
from makers
inner join baits on makers.maker_id = baits.maker_id
inner join depth_line on depth_line.bait_id = baits.bait_id
order by
makers.maker_name asc,
baits.bait,
depth_line.depth asc
into outfile '/tmp/muskie.csv'
fields terminated by ',';
Sample data from the baits table: