问题
I used the following command
SELECT json_extract(data,'$.address') FROM data;
and output as CSV file.
Output in CSV file is
enter image description here
Field (column) in CSV file is saved as 2 lines for 1 field (column).
Eg-
"71 CHOA CHU KANG LOOP
NORTHVALE"
How could I save field(column) as 1 line ?
That is I don't want to include new line character in filed(column).
Eg-
"71 CHOA CHU KANG LOOP NORTHVALE"
Thanks.
回答1:
Just replace the new line character:
select replace(json_extract(data,'$.address'), char(10), '') from data;
This will catch the newline character ('\n'
). If you want '\r'
and '\r\n'
too:
select replace(
replace(json_extract(data,'$.address'), char(10), ''),
char(13),
''
) from data;
来源:https://stackoverflow.com/questions/59504087/json-extract-sqlite-format